csh

Invoking shell from java, it complaints "stty: standard input: Invalid argument"

Hi, everybody. I invoked shell command by Process class of java and it gave "stty: standard input: Invalid argument" no matter the command is right or wrong (normal output of shell command is shown too). If I run the shell command in shell, no such error message shows. I can't figure out why. Command is something lik this {"/bin/csh", "...

in c shell, how to open a file that contains a single digit

I need to open a file using c shell. The file contains a single integer, and I need to put it into a variable, increase it and put back into the file. Meaning, if the file contains the number 5, I need, after the program runs, that the file contains the number 6. Any suggestions? ...

how to source a csh script in bash to set the enviroment

We have Oracle running on Solaris, and the shell is by default csh. So the login script sets the oracle_home, oracle_sid in csh also. But I don't like csh and want to use bash to do my work. So how to source the csh login script in bash? e.g, the following is what in the .cshrc file. And when use bash, I'd like use these variables. One ...

replace line with sed in csh

Hello, I am trying to change the content of a specific line in a batch of files. I thought that would be a piece of cake but for some reason, nothing happens, so I guess I am missing something. Line 8 should have been replaced. Here the csh script I used: #!/bin/csh # # replace context in line xxx by yyy # 2010/05/07 set files = `ls ...

How to use parallel execution in a shell script?

I have a C shell script that does something like this: #!/bin/csh gcc example.c -o ex gcc combine.c -o combine ex file1 r1 <-- 1 ex file2 r2 <-- 2 ex file3 r3 <-- 3 #... many more like the above combine r1 r2 r3 final \rm r1 r2 r3 Is there some way I can make lines 1, 2 and 3 run in parallel instead of one after the anothe...

scripts on Cshell

hello, I've got some problem, I have list of data in the file: 053-37878 03828008 Moskovitch James 500 052-34363 01234567 Mendelson Kippi 450 053-32322 03828008 Jameson Shula 350 054-39238 03333333 Merden Moshe 300 is it possible rewrite this list in the same file (without using temporary file) but without last number thanks in advanc...

Error in csh script

I'm working with C-Shell, I'm trying to run this script set callsTo = "`cut -d" " -f2 ${1}`" echo $callsTo cut receives data from the file which is the first parameter: > ./myscript data I need only second field from every row: -f2. After that I want to check if the data was stored, but I receive or an error unmatched . or empty r...

how to read rows?

I'm trying to read first row from the file > source ./rank file using this script set line = ($<) <- inside rank but when I enter echo $line I receive nothing, how can I change it? thanks in advance ...

strange behavior

I wrote simple script test echo hello #<-- inside test if I press one time enter after hello, my script will run, if I don't press - it will not, if two times I'll receive my hello and + command was not found, can somebody please explain me this behavior thanks in advance This is not a part of the code, this is actual code and I r...

unknown error in shell

can somebody explain me what does this error mean: > ./rank lines.in 'nknown option: `- Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ]. this is my script rank: #! /bin/tcsh -f set line = `cat ${1}` echo $line I think that the problem I have is with first row #! /bin/tcsh -f I'm working on Windows! but after I wrote script on ...

Selecting records with N fields from a file

can somebody help me, how can I filter my file, inside the file I have rows with 3, 4, 5 elements, I want print using echo only these which have 5 elements, thanks in advance (I'm talkin about scripts) ...

transferring via pipeline

I need to transfer data via pipe and also transfer file with this data, can I do something like this inside the script? cat ${1} | ./helper ${1} and what is the difference if I write cat ${1} | ./helper < ${1} ...

how does pipe work

hello, explain me please how exactly pipe works, for example I have this snippet of the code set line = ($<) while(${#line} != 0) if(${#line} == 5) then echo line | sort | ./calculate ${1} endif set line = ($<) end I need to choose all rows with 5 words and after sort it and after transfer, but I'm confused, how will it work,...

problem with script

I'm workin on C-Shell, can somebody help me find the bug, my script: #! /bin/tcsh -f cut -d" " -f2 ${1} | ./rankHelper script rankHelper: #! /bin/tcsh -f set line = ($<) while(${#line} != 0) cat $line set line = ($<) end file lines from which the data was sent: 053-3787837 038280083 052-3436363 012345678 053-3232287 038280083 05...

from string to integer (scripts)

I have this snippet of the code: set calls = `cut -d" " -f2 ${2} | grep -c "$numbers"` set messages = `cut -d" " -f2 ${3} | grep -c "$numbers"` @ popularity = (calls * 3) + messages and error @ expression syntax what does it mean? grep -c returns number, am I wrong, thanks in advance in $numbers I have list of numbers, 2 and ...

grep options (unix)

hello everyone, can You explain please, can grep pick rows if at least one element from the list appeared, for exmaple grep "hello world" file1 grep must give me all rows which have or word hello or world or both of them, thanks in advance ...

problems with cut (unix)

hello everybody, I've got strange problem with cut I wrote script, there I have row: ... | cut -d" " -f3,4 >! out cut recieves this data (I checked it with echo) James James 033333333 0 0.00 but I recieve empty lines in out, can somebody explain why? ...

continue in unix

hello, I'm writin scripts and I'm very curious, does c-shell have somethin like continue in C, thanks in advance ...

error in Unix (scripts)

somebody knows what does this error mean? Missing -. in google I found nothing about this ...

How to run a tcsh shell command and selectively ignore the status?

I've got a tcsh shell script that I would like to stop with an error on nonzero status most of the time, but in some cases I want to ignore it. For example: #!/bin/tcsh -vxef cp file/that/might/not/exist . #Want to ignore this status cp file/that/might/not/exist . ; echo "this doesn't work" cp file/that/must/exist . #Want to stop if th...