shell

how to get a console shell on my symbian phone?

How do I get a bash or a similar shell for my new Symbian s60 rev 5 phone (Nokia 5800) ? I already installed putty for s60, but it does not have telnet and it seems that there is no local ssh server running. ...

paste without temporary files in Unix

I'm trying to use the Unix command paste, which is like a column-appending form of cat, and came across a puzzle I've never known how to solve in Unix. How can you use the outputs of two different programs as the input for another program (without using temporary files)? Ideally, I'd do this (without using temporary files): ./progA > ...

shell - get exit code of background process

Hi, I have a command CMD called from my main bourne shell script that takes forever. I want to modify the script as follows: Run the command CMD in parallel as a background process ($CMD &). In the main script, have a loop to monitor the spawned command every few seconds. The loop also echoes some messages to stdout indicating progr...

problem in a shell command

Hi, i am trying the following command on the command line ps -u `id | cut -f2 -d"=" | cut -f1 -d"("` -f | grep ppLSN | awk '{print $9}' | awk '{FS="=";print $2}' | grep KLMN | wc -l the value of teh command is returned as 7. but when i am putting the same command inside a script abc_sh like below ps -u `id | cut -f2 -d"=" | cut ...

Problem in running a script

i have unix shell script which is need to be run like below test_sh XYZ=KLMN the content of the script is #!/bin/ksh echo $XYZ for using the value of XYZ i have do set -k before i run the script. is there a way where i can do this without doint set -k before running the script. or is there something that i can do in the script...

Best tool in unix for viewing large files

I am a novice in unix. i am facing a problem in viewing big log files in unix using Vi tool. could you please suggest the best tool for fast viewing of big files on unix. Request you to post your own ways of viewing the big files on unix. appreciate your help:) ...

Complex webapp deployment script: Shell too limited?

I inherited some release scripts that prepare and deploy a PHP webapp to around 20 servers. The scripts are written in shell and I personally find them somewhat cumbersome to maintain. That may have have to do with the way they are written but I'm looking to see if anyone has opinion or experience to corroborate the idea that I might see...

Unable to execute Ruby script from file, but IRB works fine?

I have a tiny shell script that writes to a serial device: #!/usr/bin/ruby require 'rubygems' require 'serialport' @sp = SerialPort.new "/dev/tty.usbserial-A6004cNN", 19200 @sp.write ["\x01\x01\x04\x00", "n", "\xff\xff\xff"] This doesn't write to the serial device when I run ./script.sh in that directory. However when I jump into IR...

What is the simplest way to execute arbitrary process with stdin, stdout forwarded to a socket?

I'm interested in two situations: How to do it from C++? How to do it from system's shell? Answers for Linux, Windows and OSX are welcome. ...

shell script not executed

I'm trying to set the environment variables in shell script. The command "source .bashrc" is not executed. As long as type the last line in the terminal, everything works fine. What's wrong with my script? thx. echo "export CLASSPATH=.:$HOME/java/lib export JAVA_HOME=$HOME/java export PATH=.:$PATH:$JAVA_HOME/bin" >> .bashrc source .bash...

Bourne shell script to convert a number to telephone format

I want to change a number such as 1234567890 to 456-7890; is there a way to do this in Unix Shell programming? ...

BASH: Find highest numbered filename in a directory where names start with digits (ls, sed)

I have a directory with files that look like this: 001_something.php 002_something_else.php 004_xyz.php 005_do_good_to_others.php I ultimately want to create a new, empty PHP file whose name starts with the next number in the series. LIST=`exec ls $MY_DIR | sed 's/\([0-9]\+\).*/\1/g' | tr '\n' ' '` The preceding code gives ...

Keep shell open with PHP to allow multiple calls?

Hi, How can I allow the shell session to stay open until I close it with PHP? In my example I want to use NcFtp to publish some files through shell command. I want to leave PHP's built in FTP because it is much much slower and performance is an issue. It is easy to use ncftpput to publish a file or a directory. But if I want to loop t...

ksh: Iterate through a range

How can I iterate through a simple range of ints using a for loop in ksh? For example, my script currently does this... for i in 1 2 3 4 5 6 7 do #stuff done ...but I'd like to extend the range way above 7. Is there a better syntax? Thanks! ...

Running a command in shell script

Hello I have a shell script file (run.sh) that contains the following: #!/bin/bash %JAVA_HOME%/bin/java -jar umar.jar when i try to run it (./run.sh), it gives me following: umar/bin/run.sh: line 1: fg: no job control However if I run same command directly on shell, it works perfectly. What's wrong with the script file? Thanks ...

Running a jar from shell script

Hello friends I have a jar file named umar.jar in /root/umar/bin directory. I have a shell script file run.sh in same directory. Following is the content of run.sh #!/bin/bash "$JAVA_HOME"/bin/java -jar /root/umar/bin/umar.jar Now when I run the shell script, I get the following error Exception in thread "main" java.lang.Unsupported...

Is there any simple way to benchmark python script?

Usually I use shell command time. My purpose is to test if data is small, medium, large or very large set, how much time and memory usage will be. Any tools for linux or just python to do this? ...

busybox sh wrapper to add extra functionality

I need a simple busybox sh wrapper which will do: IF "-Q" PARAMETER IS PROVIDED THEN acommand ALL PARAMETERS BUT "-Q" 2>&1 1>/dev/null ELSE acommand ALL PARAMETERS FI Parameters may include spaces. BTW I want to run the script with busybox sh and it doesn't support arrays. ...

Which language to use for implementing few Linux shell commands (homework) - plain C or C++?

I need to implement a few commands of Linux shell for my homework - 5 or 6 of them, including ls. Do not know much about which parameters to implement for each of commands... I planned to use C++, but when I asked my colleague for advice what language to choose - plain C or C++, he said that interpreter was not a program in traditional ...

java shell for executing/coordinating processes?

I know about using Runtime.exec, you pass it a native program to run + arguments. If it's a regular program, you can run it directly. If it's a shell script, you have to run an external shell program like sh or csh or cmd.exe. Is there some Java class (either standard or open-source) that implements a shell, meaning a program that you p...