shell

Is there any difference between java run.exec of a command and shell execution?

Hi all, I have a program which calls a shell command. When I executes the command using java's run.exec, it is not working but when I executes the command directly in terminal, it works like charm. ex: pdf2swf "3bbba47.pdf" -T 9 -o "3bbba47.swf" didnt worked from java program but worked directly executing it in terminal. But when...

In C how do I print filename of file that is redirected as input in shell

$cc a.c $./a.out < inpfilename I want to print inpfilename on stdout. How do I do that ? Thanks for the help in advance... ...

Shell aliasing multiple arguments

Is there a good way to do multiple substitutions for aliasing a command? For example alias cmd = 'ssh -R $1:$2:$1:$2 $3 | something {$1, $2, $3}' cmd 127.0.0.1 1234 server Something like this.. Actually, this doesn't really make any sense to pipe the output like this, but similar syntax is what I'd like to see. It's be nice to have...

How to Safely Force Shutdown of Mac

What I want I'm developing a little app to force me to only work at certain times of day - I need something to force me to stop working in the evenings so I can be more effective in the day. The option within OS X to shut down my machine at a certain time is too easy to cancel. And you can always log back in afterwards. I want my app ...

How to build one file contains other files, selected by mask?

I need to put the contents of all *.as files in some specified folder into one big file. How can I do it in Linux shell? ...

unix find command

how to use the find command to find files/directories which are not matching the pattern. for eg: find <some options > -name "dontfile.txt" should give me output of all the find whose file name is not dontfile.txt ...

How to input special character in cmd?

I have written a c program that retrieves arguments from the command line under Windows. One of the arguments is a regular expression. So I need to retrieve special characters such as "( , .", etc., but cmd.exe treats "(" as a special character. How could I input these special character? thanks. ...

Cakephp Shell Cronjob Controller Action Media Temple Server

Hi All, I'm trying to create a cron job that will send a weekly newsletter. I tried creating a shell task following what Cakephp manual says. Then I go to the Media Temple Cron jobs and type in the following: php /home/#####/domains/domain.com/html/cake/console/cake -app /home//#####//domains/domain.com/html/vendors/shells newslette...

Compare semicolon separated data in 2 files using shell script

I have some data (separated by semicolon) with close to 240 rows in a text file temp1. temp2.txt stores 204 rows of data (separated by semicolon). I want to: Sort the data in both files by field1, i.e. the first data field in every row. Compare the data in both files and redirect the rows that are not equal in separate files. Sample...

error while running a sql*plus script

Hi , i have a script which simply connect to the table in sql*plus and inserts a row in the table. it is throwing an error as below: SP2-0552: Bind variable "BIND" not declared i am not able to figure out exactly what the bind variable is in the query that it is trying to insert. ...

Is it possible to have too many $PATHs set in OS X?

I've been learning about gems lately, and one error I get is: WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and /usr/bin aren't both writable. WARNING: You don't have /Users/Alex/.gem/ruby/1.8/bin in your PATH, gem executables will not run. ERROR: Error installing rubygame: ffi requires rake (>= 0.8.7, runtime) I u...

Redirect output to a bash array

I have a file containing the string ipAddress=10.78.90.137;10.78.90.149 I'd like to place these two IP addresses in a bash array. To achieve that I tried the following: n=$(grep -i ipaddress /opt/ipfile | cut -d'=' -f2 | tr ';' ' ') This results in extracting the values alright but for some reason the size of the array is returned...

Calling bash with PHP's shell_exec -- slow.

Hi, I'm using PHP's shell_exec function to call a bash script on my server. shell_exec("bash -x /tesladata/isetools/0-extractbytickerforweb.bash $ticker $isedate > /t24alv2/iseoutput/$ticker-$isedate-$thistime.log &"); Now, I previously had the command running from a CGI script ("bash -x...") and it was much faster (instantaneous). N...

Startup time in Solaris server using shell script

How to find the start up time of a Solaris 5.1 server using a shell script,need to know how much time it took to be on running state?I need to know how much time it took to come to running mode from starting mode? ...

/bin/sh invoked from make doesn't find command with unquoted dash-argument

I have a makefile to build some transducers using Xerox' finite state tools (xfst in this case), which I invoke in my makefile like so (except with a hard tab instead of spaces in the actual makefile, of course): latin.fst: nouns.fst verbs.fst xfst -f build/latin.fst.build On my laptop (a Mac with OS X 10.6.2) this works just fine...

How do I simplify bash's 'eval "$TIME $BIN_FILE $BIN_OPTS &> $LOG_FILE"' and keep it working?

I'm updating a bash script which serves as a program testing tool. Previously, I had this line in a script working perfectly ($BIN_FILE is set to a relative path to the binary being tested): $BIN_FILE $BIN_OPTS &> $LOG_FILE Then I've decided to add some "performance measurements": time $BIN_FILE $BIN_OPTS &> $LOG_FILE" This worked ...

Recommendation - Zsh vs FishShell. Scripting, productivity and poweruser perse.

I have spent sometime trying to pick one, on net comparisons are for zsh vs bash and fish vs bash. But, I Could not find any comparison for zsh vs fish. I program in c/c++, apart from hello-world types, never done any major scripting. But now trying my hands at python and shell-scripts. Which shell keeps more juice in terms of productivi...

vi editor query

I use vi quite often to edit files. Usually I need the file to appear on screen with line numbers. For this I do set nu in edit mode. What a drag! Can I automate this? Is there any way where vi will directly open the file with line numbers visible immediately? If so, are there any other tips that will make my experience with vi more eff...

basic shell script

I have some video files all ending in .wmv .mov .mpg. I have music files ending in .mp3 .wma. And finally I have some text files all end in the extension .txt I wrote a shell script that generates subfolders, one for the music files, one for the video files, and one for the text files, and then organizes all of the files into the correc...

How can I add text to the same line?

I used this command to find mp3 files and write their name on log.txt: find -name *.mp3 >> log.txt I want to move the files using the mv command and I would like to append that to the log file so it could show the path where the files have been moved. For example if the mp3 files are 1.mp3 and 2.mp3 then the log.txt should look lik...