Red Hat ENTERPRISE LINUX WS 2.1 - Guida di Installazione Pagina 225

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
Vedere la pagina 224
Important Linux features 225
DONE
INDEX
INDEX
When executing scripta a possible output is:
Wed Jan 3 03:51:07 PST 1996
/home/guest
scripta
fila
Note: the first line of the script should be:
#! /bin/sh
2. scriptb displays the contents of a pulse program:
edit the file scriptb and enter:
dir=/opt/topspin/exp/stan/nmr/lists/pp
cd $dir
cat $1
$dir = the value of a parameter which is set in the script
$1 = an argument given to the script when it is executed
make the file executable: chmod +x scriptb
execute the script by typing its name and argument: ./scriptb zg30
3. Example of a control and loop structure in a shell script:
1
for i in ‘ls *.c‘ (for all files with the extension .c)
do
if grep strn $i
(if the file contains the string strn)
then
rm $i
(remove the file)
fi
done
1. "./" means: the command resides in the current directory. You can skip the "./" if the current
directory is part of the Linux search path. Type echo $PATH to see the Linux search path.
1. For more information on control and loop structures type man sh or man test.
Vedere la pagina 224
1 2 ... 220 221 222 223 224 225 226 227 228 229 230 ... 271 272

Commenti su questo manuale

Nessun commento