Csh script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Csh script
# 1  
Old 10-18-2011
Csh script

Hey all,

I've only just started using UNIX coding on my Masters project, so am still learning!! The script I've been writing is literally just for me to get used to writing it and seeing what I can do with some data I've been given.

I'm trying to write a script, where the penultimate line opens a new script file and tells it the language to use on the first line... however, when I try to run it it comes up with "/bin/csh : Event not found" - even though the same command works in the first line! The script is below:

#!/bin/csh
echo "Display content of file MODISdata.list"
#more MODISdata.list
/usr/bin/awk 'END {print NR}' MODISdata.list
/usr/bin/awk '$1 ~ "2000" {print}' MODISdata.list > MODISdata.list2000
/usr/bin/awk 'END{print "MODIS data files in 2000: ",NR}' MODISdata.list2000
/usr/bin/awk '$1 ~ "2010" {print}' MODISdata.list > MODISdata.list2010
/usr/bin/awk 'END{print "MODIS data files in 2010: ",NR}' MODISdata.list2010
echo "#!/bin/csh" > file1.csh
/usr/bin/awk 'NR == 1 {print "command.here",substr($1,12,1)' MODISdata.list >> file1.csh

I'm working on X11 on my mac, and editing the script on emacs...

Thanks! Smilie
# 2  
Old 10-18-2011
Try the following in your script->

Code:
echo \#\!/bin/csh > file1.csh

# 3  
Old 10-18-2011
Thanks, that worked!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

CSH Calculator Script

Using the C Shell, I'm building a script that will compute simple mathematical computations (addition, subtraction, multiplication, division). The user will enter two integers (operands) on the command line separated by the operation (operator) they wish to perform. Example of the command line... (7 Replies)
Discussion started by: ksmarine1980
7 Replies

2. Shell Programming and Scripting

how to get the value of a registry using csh script.

hi, how to get the value of a registry using csh script. thanks. (1 Reply)
Discussion started by: Rashid Khan
1 Replies

3. Shell Programming and Scripting

Understanding someone else's csh script...

Hello all. I suspect this will be a simple case for an experienced csh scripter, but google is getting me nowhere on this one. I'm trying to get someone else's set of scripts to work for me, and it's choking when the following script gets called: #! /bin/csh if (x$1 == x) then echo ' you... (1 Reply)
Discussion started by: EinsteinMcfly
1 Replies

4. Shell Programming and Scripting

Is there any script to convert sh to csh ?

Hi All Is there anyone who have the script to covnert a sh sell script to csh and can share with me? Thanks a lot! Nick:b: (3 Replies)
Discussion started by: nicolast0604
3 Replies

5. Shell Programming and Scripting

csh script help

Hey I am brand new to this forum and scripting. I have several documents (1000+) all formated exactly the same. Each document contains 97 lines. I want to pull 3 lines from the documents to populate a file. These 3 lines are line number 9, 24, and 58. Ok my questions: Instead of using... (3 Replies)
Discussion started by: david6789
3 Replies

6. Shell Programming and Scripting

how to source csh script in tcl script

i have atcl script and i want to source a csh script to reflect changes done by script ........ Please help....... (0 Replies)
Discussion started by: paragarora47
0 Replies

7. Shell Programming and Scripting

Help with csh script

Ok I asked something similar earlier with no response, so maybe I didn't word it correctly. I'm new at this, so thank you for your help. Here's what I have right now. ---------------------------- > cat MySourceFile #!/bin/csh echo "Please Enter Value For My_Env_Var:" set answer = $< ... (1 Reply)
Discussion started by: MMorrison
1 Replies

8. Shell Programming and Scripting

csh failing to call an 2 embedded csh script

I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them) Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++... (1 Reply)
Discussion started by: pollsizer
1 Replies

9. Shell Programming and Scripting

Problem with csh script

Hi All, I have the following script. #!/bin/csh # # createDATfile.sh # cd /export/home/fastserv/bin source /export/home/fastserv/bin/dbenv.sh echo `date` >> /export/home/fastserv/bin/log.txt echo "%INF% Starting send of current FASTSERVICE batch" >>... (4 Replies)
Discussion started by: rahulrathod
4 Replies

10. Shell Programming and Scripting

Calling C from within a csh script

After I compile a C program, when I run it from a C shell script, it does not print out the results. e.g: myCFile.c: main(){printf("Hey");} myCshScript: myCFile This does not output "Hey" to the terminal window. I am not even sure if it is executed or not. What should I do to see the... (2 Replies)
Discussion started by: barisgultekin
2 Replies
Login or Register to Ask a Question