:r Remove last suffix
:h Remove last / and after
:t Remove last / and before
:e Remove last . and before
$?<variable name> - variable is set?
set <variable name>=$<
read <variable name>
readonly <variable name>
Array
set <variable name>=(value1 value2 value3 ...)
from <variable name>[1] is set
$#<variable name> provide the number of variable
% <script file name> arg1 arg2 arg3
$0 $1 $2 $3
$argv[1]$argv[2]$argv[3]
all argument $* or $argv
number of argument $#argv
Set the value from position parameter
set value1 value2 value3
$1 $2 $3
% <script file name> arg1 arg2 arg3
$0 $1 $2 $3
all argument $*
number of argument $#
{ <command> } true if normal exit(0)
test <condition expression> true if normal exit(0)
[ <condition expression> ] true if normal exit(0)
>, <, >>
>& stdout and stderr
>, <, >>
2> stderr
> file 2>&1 stdout and stderr
@ <variable name> = expression
>> <number of shift> bit shift
~ complement of 1
! logical no
| bit level or
^ bit level exclusive or
& bit level and
|| logical sum
&& logical survey
<variable name> = `expr expression`
-a logical survey
-o logical sum
! logical no
== equal
!= not equal
=~ equal and enable meta character
!~ not equal and enable meta character
= equal
!= not equal
<String> - true if not null
-z <String> - true if 0
-n <String> - true if not 0
==, !=, >, <, >=, <=
-eq, -ne, -gt, -ge, -lt, -le
-r true if read
-w true if write
-x true if execute
-e true if exist
-o true if owner
-f true if normal
-z true if 0 size
-d true if directory
-r true if read
-w true if write
-f true if normal
-s true if size is not 0
-d true if directory
if ( expression ) then
command list
else if ( expression ) then
command list
else
command list
endif
switch ( character set )
case pattern:
command
breaksw
case pattern:
command
breaksw
default:
command
breaksw
endsw
if test command
then
command list
else
command list
fi
if test command; then command list; else command list; fi
case word in
pattern)
command list
;;
pattern)
command list
;;
esac
foreach <variable name> ( value1 value2 value3 ... )
command list
end
while ( expression )
command list
end
goto <label name>
shift <array variable name>
break end loop
continue back to top of the loop
exit(<value>) end of execution
for <variable name> in value1 value2 value3 ...
do
command list
done
while test command
do
command list
done
until test command
do
command list
done
shift <array variable name>
break end loop
continue back to top of the loop
exit <value> end of execution