DASH(1) General Commands Manual DASH(1) (NAME) dash - () (SYNOPSIS) dash [-aCefnuvxIimqVEb] [+aCefnuvxIimqVEb] [-o option_name] [+o option_name] [command_file [argument ...]] dash -c [-aCefnuvxIimqVEb] [+aCefnuvxIimqVEb] [-o option_name] [+o option_name] command_string [command_name [argument ...]] dash -s [-aCefnuvxIimqVEb] [+aCefnuvxIimqVEb] [-o option_name] [+o option_name] [argument ...] (DESCRIPTION) dash . dash POSIX 1003.2 1003.2a . Korn Korn ( ksh(1)). POSIX, . . (Overview) . ( chsh(1) ). . ( ) . . (Invocation) ( -i ) -c (interactive) . (prompt) ( ). `-' (login shell) . . /etc/profile .profile . ENV .profile ENV . .profile ENV . ENV .profile : ENV=$HOME/.shinit; export ENV ".shinit" . ( ) ($1 $2 ) . . (Argument List Processing) -o . -o . "-" "+" . set ( ) . -a allexport (export) . -c command_string . 0 command_name ($1 $2 ) . -C noclobber ">". -e errexit . if, elif, while, until "&&" "||" . -f noglob (pathname expansion). -n noexec . (syntax) . -u nounset . -v verbose . . -x xtrace ( `+ ') . . -I ignoreeof (EOF) . -i interactive . -l (login shell) dash. -m monitor (job control) ( ). -s stdin ( ). ( set) . -V vi vi(1) ( -E, ). -E emacs emacs(1) ( -V, ). -b notify . ( 4.4alpha) (Lexical Structure) ( ) "" . : ( ). : : & && ( ) ; ;; | || : < > >| << >> <& >& <<- <> (Quoting) . : (). (Backslash) . . (Single Quotes) ( ). (Double Quotes) ($), (`), (\). : $ ` " \ . . (Reserved Words) . : ! elif fi while case else for then { } do done until if esac . (Aliases) alias(1) . ( ) . . "lf" "ls -F" : lf foobar : ls -F foobar . . . (Commands) ( BNF POSIX 1003.2 ). ( ) . . (Simple Commands) : 1. "name=value" . ( ) . 2. " (Expansions)" . . "name=value" . 3. . (Redirections) . . : [n] redir-op file redir-op . . [n] 0 9 `3' ( `[3]'), (file descriptor) . [n]> file ( n) . [n]>| file -C. [n]>> file ( n) . [n]< file ( n) . [n1]<&n2 n2 stdin ( n1). [n]<&- ( n). [n1]>&n2 n2 stdout ( n1). [n]>&- ( n). [n]<> file ( n). "here-document" : [n]<< delimiter here-doc-text ... delimiter (delimiter) n ( ) . here-doc ( "" ). "<<" "<<-" here-doc . (Search and Execution) : - ( ) . . ( $0 ) . ( ) . . . . . ( ). . ( " " ASCII "#!" execve(2) ENOEXEC ) (subshell) . . " (shell procedure)" . (Path Search) . . : 1. . 2. PATH . PATH (colon) . . . (Command Exit Status) . . . . 0 . (Complex Commands) . : o o (pipeline) o o o . (Pipelines) | . . . : [!] command1 [| command2 ...] command1 command2 . . ( ) . pipefail . pipefail . ! NOT . . : $ command1 2>&1 | command2 command1 command2 . ; AND-OR ( ) & AND-OR . ( - ). - & (&) - . : command1 & [command2 & ...] /dev/null . - (semicolon) . . . (Short-Circuit List Operators) "&&" "||" AND-OR . "&&" . "||" . "&&" "||" . - if, while, for, case if : if list then list [ elif list then list ] ... [ else list ] fi while : while list do list done . until until while . for : for variable [ in [ word ... ] ] do list done in variable . in word ... in "$@" . break continue : break [ num ] continue [ num ] Break num for while . Continue . . case : case word in [(]pattern) list ;; ... esac ( ) "|" . "(" . (Grouping Commands Together) : (list) { list; } (subshell) . (list) . . : { printf " hello " ; printf " world\n" ; } > greeting "}" ( ";") . (Functions) : name () command name . command "{" "}" . local . : local [variable | -] ... Local . (exported) (readonly) ( ) . . (dynamic scoping) x f f g x g x f x. "-" . "-" set . return : return [exitstatus] . Return . (Variables and Parameters) . . . : name=value (underscore) - . . (Positional Parameters) (n > 0). . set . (Special Parameters) . . * . IFS IFS . @ . . @ @ . $1 "abc" $2 "def ghi" "$@" : "abc" "def ghi" # . ? . - ( ) ( ) set . $ (PID) . $ . ! (PID) . . 0 () . (Word Expansions) . . . . @ . : 1. ( ). 2. () IFS (null) . 3. ( set -f ). 4. . $ . ( ) (~) . (/) . ( ~/foobar), HOME ( ) . (Parameter Expansion) : ${expression} (expression) "}" . "}" "}" . : ${parameter} parameter ( ) . . : 1. . 2. @. : ${parameter:-word} . parameter word parameter . ${parameter:=word} . parameter word parameter . parameter . . ${parameter:?[word]} . parameter word ( word) . parameter . . ${parameter:+word} . parameter word . . ${#parameter} . parameter . . ( ) (regex) . parameter * @ . . ${parameter%word} . word . parameter . ${parameter%%word} . word . parameter . ${parameter#word} . word . parameter . ${parameter##word} . word . parameter . (Command Substitution) . : $(command) ( " "): `command` command . ( IFS .) (Arithmetic Expansion) . : $((expression)) . (tokens) . . (Field Splitting) . IFS . IFS . IFS "read -r l" "IFS= read -r l" l . ( ) -f . . . : . case . (Shell Patterns) (meta-characters) . : "!", "*", "?", "[". . . ("*") . . ("[") . ("]") "]" "[" "[" . . . . "]" ( "!", ). . (Builtins) . ( printf(1), echo(1), test(1), ). : true (null) 0 ( / true) . false (null) 1 ( / false) . . file . alias [name[=string ...]] name=string name string . name name . alias ( unalias). bg [job] ... ( ) . command [-p] [-v] [-V] command [arg ...] . ( .) -p PATH . -V . type . -v . cd|chdir - cd|chdir [-LP] [directory] ( HOME). CDPATH cd CDPATH CDPATH . CDPATH PATH . OLDPWD . cd . CDPATH . -P . -L -P . echo [-n] args... . -n . : \b (backspace) . \c . echo . \f (form feed). \n (newline). \r (carriage return). \t (). \v . \0digits ( ) . (nul) . \\ (). . eval string ... . exec [command arg ...] command ( ). exec exec . exit [exitstatus] . exitstatus . export name ... export -p (export) . (unset) . : export name=value export . -p, . fc [-e editor] [first [last]] fc -l [-nr] [first [last]] fc -s [old=new] [first] fc . -e editor editor . editor PATH . FCEDIT -e . FCEDIT EDITOR . EDITOR ed(1) . -l (ell) . first last -r, . -n -l. -r ( -l) ( -l -s). -s . first last . HISTSIZE . first last : [+]number -l . -number . -1 . string . old=new -s . fc : FCEDIT . HISTSIZE . fg [job] . getopts optstring var [arg ...] getopts POSIX, (Bell Labs-derived) getopt(1) . . . getopts getopt(1) . getopts . getopts var OPTIND . OPTIND 1 . getopts OPTARG . optstring OPTARG . $1, ..., $n args, . optstring ( getopt(3)). . getopts var "?" getopts OPTARG . optstring . getopts var "?" . [a] [b], [c] : while getopts abc: f do case $f in a | b) flag=$f;; c) carg=$OPTARG;; \?) echo $USAGE; exit 1;; esac done shift $((OPTIND - 1)) : cmd -acarg file file cmd -a -c arg file file cmd -carg -a file file cmd -a -carg -- file file hash [command ...] hash -r (hash table) . hash . cd . hash ( ) . -r hash . jobs [-lp] [job ...] job: (+-) . -l PID PID . -p PID . kill [-s sigspec | -signum | -sigspec] [pid | job ...] kill(1), job . SIG TERM . kill -l [signum | exitstatus] SIG (sigspecs). signum sigspec . exitstatus (> 128), sigspec . pwd [-LP] . . pwd . -P . -L -P . read [-p prompt] [-r] variable [...] -p (prompt) . . . . ( IFS ) . . read (EOF) . -r, "\" . . readonly name ... readonly -p . : readonly name=value readonly . -p, . printf format [value]... printf format : value . value b, c, s C : o . o . value . . ANSI X3.159-1989 ("ANSI C89") . : \a < (bell)>. \b < (backspace)>. \f < (form-feed)>. \n < (new-line)>. \r < (carriage return)>. \t < (tab)>. \v < (vertical tab)>. \\ (). \num ASCII num . (``%'') . : : # `#' `` '' . b, c, d, s, . o . x (X), 0x (0X) . e, E, f, g, G, ( ). g G, . - `-' + `+' . ` ' . `+' 0 `0' . `-' `0' (Field Width): ( ) ( ) (Precision): `.', e f, (b s) (Format): ( diouxXfwEgGbcs). `*' . argument . : diouXx argument (d i) (X x) . f argument [-]ddd.ddd d . . eE argument [-]d.ddde+-dd . E `E' . gG argument f e (E) . b argument . : \c dash . \0num ASCII num . c argument . s argument . % `%' . . set [{ -options | +options | -- }] arg ... set . . . -o +o . -o +o . -o +o : pipefail . set . "--" set . set ( "shift $#".) shift [n] n . shift $1 $2, $2 $3, $# . n shift 2 . test expression [ expression ] test expression (true) (true) 1 (false) . test 1 (false) . test . (primaries) : -b file file . -c file file . -d file file . -e file file ( ). -f file file . -g file file (setgid) . -h file file . -k file file (sticky bit) . -n string string . -p file file (FIFO) . -r file file . -s file file . -t file_descriptor file_descriptor . -u file file (setuid) . -w file file . . . -x file file . . file file . -z string string . -L file file . . -h . -O file file (effective UID) . -G file file (effective GID) . -S file file . file1 -nt file2 file1 file2 file1 file2 file1 file2 . file1 -ot file2 file1 file2 file1 file2 file2 file1 . file1 -ef file2 file1 file2 . string string . s1 = s2 s1 s2 . s1 != s2 s1 s2 . s1 < s2 s1 ASCII s2 . s1 > s2 s1 ASCII s2 . n1 -eq n2 n1 n2 . n1 -ne n2 n1 n2 . n1 -gt n2 n1 n2 . n1 -ge n2 n1 n2 . n1 -lt n2 n1 n2 . n1 -le n2 n1 n2 . : ! expression expression . expression1 -a expression2 expression1 expression2 . expression1 -o expression2 expression1 expression2 . (expression) expression . -a -o . times . 0 . trap [action signal ...] action . . signal 0 EXIT ( SIGINT). action (''), . action `-' . ( ) . trap . trap . : trap trap '' INT QUIT tstp 30 INT QUIT TSTP USR1 trap date INT INT type [name ...] name . : . . ulimit [-H | -S] [-a | -tfdscmlpnvwr [value]] (hard) (soft) . ( ) ( ) : -H -S . -H -S . . : -a -t CPU ( ) -f ( ) -d ( ) -s ( ) -c core dump ( ) -m ( ) -l mlock(2) ( ) -p -n -v ( ) -w -r (real-time) . value . value unlimited . sysctl(8) . umask [mask] umask ( umask(2)) . umask . unalias [-a] [name] name . -a . unset [-fv] name ... (unexport) . -f -v . . wait [job] . . (Command Line Editing) dash ( fc ) vi . vi . `set -o vi' vi sh (insert mode) vi . vi sh (command mode) . vi : vi . . (EXIT STATUS) . . exit . (ENVIRONMENT) HOME login(1) (passwd(5)) . cd . PATH . . CDPATH cd. MAIL . MAILPATH . MAILCHECK MAILPATH MAIL . 0 . MAILPATH ":" . MAIL . . PS1 "$ ", (superuser) "# " . PS2 "> " . PS4 (set -x) "+ " . IFS (Input Field Separators). , , . . TERM . . HISTSIZE . PWD . cd . OLDPWD . cd . PPID (PID) . (FILES) $HOME/.profile /etc/profile (SEE ALSO) csh(1), echo(1), getopt(1), ksh(1), login(1), printf(1), test(1), getopt(3), passwd(5), environ(7), sysctl(8) (HISTORY) dash POSIX /bin/sh . dash NetBSD ash ( Almquist SHell) . dash . (BUGS) Setuid . Linux 6.12.107+deb13-amd64 January 19, 2003 Linux 6.12.107+deb13-amd64