Table of Contents
See command expr.
/bin/echo —help Usage: /bin/echo [OPTION]… [STRING]… Echo the STRING(s) to standard output.
-n do not output the trailing newline -e enable interpretation of backslash escapes -E disable interpretation of backslash escapes (default) --help display this help and exit
tmpf=tmp.$$ trap "rm -f $tmpf" 0 trap "exit 2" SIGHUP SIGINT SIGQUIT SIGTERM # 1 2 3 15
cat > $tmpf cat $tmpf ..
Trap set & show:
$ trap -p
$ trap 'rm semaphore' 0
$ trap 'rm semaphore' SIGINT
$ trap -p trap -- 'rm semaphore' EXIT trap -- 'rm semaphore' SIGINT
$ trap -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL [..]
$ set -x
Press ^C:
$ ++ rm semaphore rm: cannot lstat `semaphore': No such file or directory
Trap reset:
$ trap - SIGINT + trap - SIGINT
Press ^C again, no more traps:
$
In unix:
sleep 10
sleep 10 seconds
To execute a command after a certain amount of time:
(sleep 105; command)&
sendf can't use this way (when user interaction is needed). Put it in foreground instead. |
-r Recursively remove directories and subdirectories in the argument list. -f Remove all files (whether write-protected or not) in a directory without prompting the user.
$ pidof emacs 1795 1506 1495
$ [ `/sbin/pidof nono` ] && echo aaa
$ [ `/sbin/pidof X` ] && echo aaa aaa
script [-a] [-c COMMAND] [file]
For single command, you can use
script -c COMMAND
-c COMMAND Run the COMMAND rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves differently when its stdout is not a tty.
most -ct4 +82 keymap.c
makes searches case sensitive, sets tabwidth to 4, and displays the file keymap.c starting at line 82.
MOST version S4.8.1 Usage: most [-1bckstvw] [+/string] [+line number] [+s] [+d] file... where: -1: assume VT100 terminal. (VMS only) -b: Startup in binary mode. -c: Make searches case sensitive. -k: Kanji mode. -s: Squeeze out excess blank lines. -t: Display tabs as ^I. If this option is immediately followed by an integer, the integer sets the tab width. -v: Do not interpret backspace formatting characters. -w: Wrap lines. -z: No gunzip-on-the-fly. +/string: Search for string +line number Start up at specified line number. +d: Allow file deletion. +s: Secure Mode-- no edit, cd, shell, and reading files not already listed on the command line.