no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


csh [2013/06/03 20:59] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== #!/bin/csh ======
  
 +  * [[FreeBSD]]
 +  * [[bash]]
 +  * [[ksh]]
 +  * [[sh]]
 +  * [[tcsh]]
 +  * [[zsh]]
 +
 +  * [[http://www.mcsr.olemiss.edu/unixhelp/shell/oview1.1.html|Summary of shell facilities]]
 +  * [[http://www.grymoire.com/Unix/Csh.html|csh tutorial]]
 +  * [[http://www.grymoire.com/Unix/CshTop10.txt|Top Ten Reasons not to use the C shell]]
 +
 +Welcome to the C shell.
 +
 +=== Syntax ===
 +
 +Output to ''dev/null'':
 +
 +<code>
 +portsnap extract >& /dev/null
 +</code>
 +
 +== File Operators ==
 +
 +  * **-e**  file exists
 +  * **-o** file exists and is owned by the user
 +  * **-r** file exists and is readable
 +  * **-w** file exists and is writable
 +  * **-x** file exists and is executable
 +  * **-z** file exists and is zero size
 +  * **-d** dir exists and is a directory
 +
 +=== Examples ===
 +
 +== Loops ==
 +
 +The syntax is different here, in that there is no ''in'' keyword.
 +
 +<code>
 +#!/bin/csh
 +foreach x ( one two three )
 +  echo number $x!
 +end
 +</code>
 +
 +== If .. Then ==
 +
 +<code>
 +#!/bin/csh
 +foreach filename ( foo.tar.gz bar.tar.bz2 )
 +  if ( ! -e $filename ) then
 +    echo "I can't find $filename anywhere!"
 +  endif
 +end
 +</code>
 +
 +== Passing Arguments ==
 +
 +<code>
 +#!/bin/csh
 +echo found $#argv arguments
 +echo first argument is: $argv[1]
 +echo second argument is: $argv[2]
 +</code>
 +
 +<code>
 +args.csh Hello CSH
 +</code>

Navigation
QR Code
QR Code csh (generated for current page)