tags:

views:

14

answers:

1

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 row. What is wrong with my script?

Also when I'm using #! /bin/tcsh -f I receive this message

 tcsh [ -bcdefilmnqstvVxX ] [ argument ... ]
A: 

I do not know tcsh but shouldn't this line

set callsTo = "`cut -d" " -f2 ${1}`"

be

set callsTo = `cut -d" " -f2 ${1}`?

In bash I would have done this way:

callsTo=`cut -d' ' -f2 $1`?

Hope this helps.

Alberto Zaccagni
no, unfortunately
lego69
`callsTo=$(cut -d' ' -f2 "$1")` in bash. `$()` is more predictable for users and nests better, compared to backticks. I don't know the equivalent csh, but looking for it might help.
Roger Pate