.sh to .csh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting .sh to .csh
# 1  
Old 10-22-2011
Bug .sh to .csh

Hi All,
Could any one of you give me a hand to convert the following line of codes from .sh to .csh please ?
Code:
proc_id=`fuser /tmp/test`
if [ ! -n "$proc_id" ]
then
  echo "File is not being used by any thing"
fi
if [ $proc_id -ne "21" ]
then
  echo "File is being used... please wait"
  sleep 1
fi


Regards.

Last edited by Franklin52; 10-22-2011 at 10:59 AM.. Reason: Please use code tags for data and code samples, thank you
# 2  
Old 10-22-2011
Code:
#!/bin/csh
set proc_id=`fuser /tmp/test`
if ( $proc_id == 0 ) then
  echo "File is not being used by any thing"
endif
if ( $proc_id != 21 ) then
  echo "File is being used... please wait"
  sleep 1
endif

--ahamed

PS : Please use code tags. Thank you for your co-operation.
And do not post twice!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

What does this do in CSH?

CSH experts What does the following do in CSH? :(){:|:&};: I was asked the question, but I don't know. I'm not aware of the context. Any ideas? Thanks! (1 Reply)
Discussion started by: wallg
1 Replies

2. Shell Programming and Scripting

Using \n in csh

I am trying to use \n for a new line in csh like this echo "some text\n" echo "some more text\n" but am getting some text\n some more text\n (10 Replies)
Discussion started by: kristinu
10 Replies

3. Shell Programming and Scripting

if in csh

I am using this code echo "opt_tpath = $opt_tpath" if ($opt_tpath == 1) echo " -tpath = $Atpath\n" and is giving opt_tpath = 0 Atpath: Undefined variable. Atpath should only be printed in opt_tpath == 1 but it still tries to print. ---------- Post updated at 10:05 AM ----------... (1 Reply)
Discussion started by: kristinu
1 Replies

4. Shell Programming and Scripting

#!/bin/csh -f :: What does it mean

Hi, I have a script which I need to modify. It contains the following statement at the beginning - 1. What does this mean ? #!/bin/csh -f 2. If I run the following code in a script on C SHELL it runs normally. host=0 if ; then host="<<something>>" fi But, in the script... (7 Replies)
Discussion started by: angshuman_ag
7 Replies

5. UNIX for Dummies Questions & Answers

csh

what is a .csh extension? there is a command line: mkaphed_ctio.csh Does anyone know what this is? :confused::confused::confused: (1 Reply)
Discussion started by: cosmologist
1 Replies

6. 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

7. Shell Programming and Scripting

sh and csh issue

Hi I like to assign a command string to a variable to execute. In this case, set sshexec_parent_pid="ps -ef | grep $$ | awk '/bash -c/ {print $3}' | sort | head -1;`" echo $sshexec_parent_pid ; But I can't seem to get it to work. It gives me sshexec_parent_pid: Undefined variable. ... (2 Replies)
Discussion started by: mpc8250
2 Replies

8. UNIX for Dummies Questions & Answers

csh History

Hello everybody, Im being unsuccessful to enable command history logging in csh shells on a Sun machine running Solaris 9, I know csh doesnt log commands history by itself, here under is my /.cshrc file: # @(#)cshrc.standard 1.1 Copyright 1994, Motorola Inc. if ( -e /.datagen_system )... (8 Replies)
Discussion started by: aladdin
8 Replies

9. Shell Programming and Scripting

csh problem with while

Hello this my first post, so i hope you help me echo -n "Choose which square you want to hit of PL2 grid " set pl2_square = $< set i = 1 while ($i <= 6) if ($pl2_square == $pl2_ships) then $pl2_ships = x echo "" echo "" echo "PL1 has hitted a square of PL2" echo... (5 Replies)
Discussion started by: amaj1407
5 Replies

10. Shell Programming and Scripting

Need a better find for csh

At /home/me/bin I've got a script called fg. The meat of it is: find . -name "$1" | xargs grep $2 The intent is to call it as "fg file_pattern search_pattern" and search all matching files. I've added the directory to my path and made the file executable, but when I try to use it I get ... (3 Replies)
Discussion started by: James McMurray
3 Replies
Login or Register to Ask a Question