Поиск по:comet.sai.msu.ru -
Поискать по всем серверам
На этой странице приведены все страницы сервера comet.sai.msu.ru ,которые мы индексируем. Показаны документы 961 - 980 из 1544.
Упорядочить по:
URL
|
дате изменения
961. Examples of using the while and until statements
To wait for someone to logout: #!/bin/sh while who |grep -s $1 >/dev/null do sleep 60 done echo "$1 has logged out" . This script checks to see if the username given as an argument to the script is logged on. ... When it is found that the user is no longer logged on a message that they have logged out is displayed. To declare when a file has been created: #!/bin/sh until test -f $FILE do sleep 60 done echo "$FILE now exists" . ... A message is then displayed. ...
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.6.3.2.html -- 2.9 Кб -- 17.01.1997
Похожие документы
Похожие документы
962. The while and until statements
The while statement has the general form: while command-list1 do command-list2 done . The commands in command-list1 are executed; and if the exit status of the last command in that list is 0 (zero), the commands in command-list2 are executed. ... This is identical in function to the while command except that the loop is executed as long as the exit status of command-list1 is non-zero. The exit status of a while/until command is the exit status of the last command executed in command-list2 . ...
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.6.3.html -- 2.7 Кб -- 17.01.1997
Похожие документы
Похожие документы
963. Example of using the break and continue statements
. To prompt for commands to run: #!/bin/sh while echo "Please enter command" read response do case "$response" in 'done') break # no more commands ;; "") continue # null command ;; *) eval $response # do the command ;; esac done . This prompts the user to enter a command. While they enter a command or null string the script continues to run. To stop the command the user enters done at the prompt.
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.6.4.1.html -- 2.2 Кб -- 17.01.1997
Похожие документы
Похожие документы
964. The break and continue statements
... The statements break and continue are used for this. The break command terminates the execution of the innermost enclosing loop, causing execution to resume after the nearest done statement. ... The continue command causes execution to resume at the while , until or for statement which begins the loop containing the continue command. You can also specify an argument n|FR to continue which will cause execution to continue at the n|FR th enclosing loop up. ...
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.6.4.html -- 2.5 Кб -- 17.01.1997
Похожие документы
Похожие документы
965. Flow of control statements
. The Bourne shell provides several flow of control statements. Select an item for further information. The case statement . The for statement . The while and until statements . The break and continue statements .
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.6.html -- 2.0 Кб -- 17.01.1997
Похожие документы
Похожие документы
966. Doing arithmetic
. The shell does not have any arithmetic features built in and so you have to use the expr command. Details are in the expr manual page.
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.7.1.html -- 1.8 Кб -- 17.01.1997
Похожие документы
Похожие документы
967. Including text in a shell script
Text can be included in the shell script by using a here document, a special form of input redirection. The << symbol is used to indicate that text should be read up to a given mark. For example: #!/bin/sh # this script outputs the given text before it runs cat << EOF This shellscript is currently under development, please report any problems to Danny (danny@cornflake.ed) EOF exec /usr/local/test/bin/test_version . ...
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.7.2.html -- 2.2 Кб -- 17.01.1997
Похожие документы
Похожие документы
968. Forcing evaluation of commands
. Another built-in function is eval which takes the arguments on the command line and executes them as a command. For example: #!/bin/sh echo "enter a command:" read command eval $command .
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.7.3.html -- 1.8 Кб -- 17.01.1997
Похожие документы
Похожие документы
969. Execute a command without creating a new process
. The exec statement causes the command specified as its argument to be executed in place of the current shell without creating a new process. For example: exec zmail -visual . This runs just the zmail program without a shell. When you quit the application the current shell also exits.
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.7.4.html -- 2.0 Кб -- 17.01.1997
Похожие документы
Похожие документы
970. Controlling when to exit a shell script
The exit statement will exit the current shell script. ... If omitted the exit status of the last run command is used. 0 (zero) signifies success, non-zero signifies failure. For example: #!/bin/sh if [ $# -ne 2 ] # "$#" is number of parameters- here we test # whether it is not equal to two then echo "Usage $0 \<file1\> \<file2\>" # not two parameters # so print message exit 2 # and fail ($0 is # name of command). fi ...< rest of script > . ...
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.7.5.html -- 2.4 Кб -- 17.01.1997
Похожие документы
Похожие документы
971. More shell functions
. This section provides you with information about several functions which can be used within a Bourne shell script. Doing arithmetic . Including text in a shell script . Forcing evaluation of commands . Execute a command without creating a new process . Controlling when to exit a shell script . Trapping operating system signals .
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.7.html -- 2.1 Кб -- 17.01.1997
Похожие документы
Похожие документы
972. Example of debugging a shell script
To print commands and their arguments as they are executed: cat example #!/bin/sh TEST1=result1 TEST2=result2 if [ $TEST1 = "result2" ] then echo $TEST1 fi if [ $TEST1 = "result1" ] then echo $TEST1 fi if [ $test3 = "whosit" ] then echo fail here cos it's wrong fi . This is a script called example which has an error in it; the variable $test3 is not set so the 3rd and last test [ command will fail. Running the script produces: example result1 [: argument expected . ...
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.8.1.html -- 2.7 Кб -- 17.01.1997
Похожие документы
Похожие документы
973. Debugging shell scripts
. To see where a script produces an error use the command: sh -x script argument . The -x option to the sh command tells it to print commands and their arguments as they are executed. You can then see what stage of the script has been reached when an error occurs. Other debugging options . Example .
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.8.html -- 2.1 Кб -- 17.01.1997
Похожие документы
Похожие документы
974. Debugging options
. You can use the following options either on the command line or with the built-in set command within a shell script to help you when debugging. -e in non-interactive mode, exit immediately if a command fails. -v print shell input lines as they are read. -n read commands but do not execute them.
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.8.op.html -- 2.0 Кб -- 17.01.1997
Похожие документы
Похожие документы
975. Signals to be caught
. The following are the signals that are usually caught with the trap command. 0 shell exit (for any reason, including end of file EOF). 1 hangup. 2 interrupt (^C). 3 quit (^\\ ; causes program to produce a core dump). 9 kill (cannot be caught or ignored). 15 terminate; default signal generated by kill.
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.9.1.html -- 2.1 Кб -- 17.01.1997
Похожие документы
Похожие документы
976. trap: Handling command lists
The command list is placed between single quotes, as the command line is scanned twice, once when the shell first encounters the trap command and again when it is being executed. trap ' command-list ' signal-list . ... If command-list is not specified, then the action taken on receipt of any signal in the signal-list is reset to the default system action. If command-list is an explicitly quoted null command (' ' or " "), then the signals in signal-list are ignored by the shell. ...
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.9.2.html -- 2.7 Кб -- 17.01.1997
Похожие документы
Похожие документы
977. Examples of interrupt handling
To use single quotes to inhibit command substitution: #!/bin/sh trap 'echo `pwd` >>$HOME/errdir' 2 3 15 for i in /bin /usr/bin /usr/any/bin do cd $i some series of commands in the directory $i done . The file errdir will contain the name of the directory being worked on when the procedure is interrupted. ... To remove temporary files when a procedure is interrupted: #!/bin/sh temp=/tmp/file.$$ trap 'rm $temp; exit' 0 1 2 3 15 ls > $temp .. ...
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.9.3.html -- 3.4 Кб -- 17.01.1997
Похожие документы
Похожие документы
978. Trapping operating system signals
. Shell procedures may use the trap command to catch or ignore Unix operating system signals . The form of the trap command is: trap ' command-list ' signal-list . Several traps may be in effect at the same time. If multiple signals are received simultaneously, they are serviced in ascending order. To check what traps are currently set use the trap command. For example: trap . Most common signals to be caught . Handling command lists . Examples .
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.9.html -- 2.3 Кб -- 17.01.1997
Похожие документы
Похожие документы
979. Bourne shell programming
. The shell also provides you with a programming environment with features similar to those of a high level programming languages. Examples . Passing arguments to the shell . Handling shell variables . Reading user input . Conditional statements . Testing for files and variables . Flow of control statements . More shell functions . Debugging shell scripts . Getting further information .
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.html -- 2.3 Кб -- 17.01.1997
Похожие документы
Похожие документы
980. Examples of Bourne shell scripts
To read input to a command and process it in some way: #!/bin/sh # usage: fsplit file1 file2 total=0; lost=0 while read next do total=`expr $total + 1` case "$next" in *[A-Za-z]*) echo "$next" >> $1 ;; *[0-9]*) echo "$next" >> $2 ;; *) lost=`expr $lost + 1` esac done echo "$total lines read, $lost thrown away" . ... The script then processes the lines as follows: . ... The user types the command: process sub-directory . This script will read and process commands in the named sub-directory . ...
[
Сохраненная копия
]
Ссылки http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.x.html -- 3.8 Кб -- 17.01.1997
Похожие документы
Похожие документы