Shell
Emanuele Valea <valea@lirmm.fr> LIRMM CNRS / Université de Montpellier
Shell Emanuele Valea <valea@lirmm.fr> LIRMM CNRS / Universit - - PowerPoint PPT Presentation
Shell Emanuele Valea <valea@lirmm.fr> LIRMM CNRS / Universit de Montpellier Shell It is the external layer of the Operating System It provides a communication link between the O.S. and user Interactive execution Script
Emanuele Valea <valea@lirmm.fr> LIRMM CNRS / Université de Montpellier
and user
/ directors separator in a path ? any character * a sequence of any character ~ login directory ~user login directory of the user [ ] any character between [] { } any word between {} (separated by ,) ‘…’ does not expand regular expression
the configuration files:
starts
stored in the filec variable (TAB or ESC)
shell searches in the directories specified in the PATH variable
the current directory
expressions
file name that satisfy the expressions
> ls file1 file2 rc.conf myconf.txt > ls -l file* Shell > ls -l file1 file2
> ls file1 file2 rc.conf myconf.txt > ls -l *conf* Shell > ls -l rc.conf myconf.txt
> ls file1 file2 rc.conf myconf.txt > ls -l ‘*conf*’ Shell > ls -l ‘*conf*’
> ls file1 file2 rc.conf myconf.txt > find –name *config* Shell > find –name
> ls file1 file2 rc.conf myconf.txt > find -name ‘*config*’ Shell > find -name *config*
process stdin stdout stderr
stdin from file
stdout to file (deleted if exists)
stdout appended to file
text HERE
pipe
between the two processes
proc stdin stdout stderr proc stdin stdout stderr
shows the commands executed before
shows the history
executes the nth command stored in the buffer
executes the n - last command
the last parameter of previous command
all the parameters of the previous command
the last command having the first characters of the name matching with string
rm word2
a.out word word2
cc prog.c iop.c
cc -g prog.c
rm word word2
25% cc -g prog.c 26% vi iop.c 27% cc prog.c iop.c 28% a.out word word2
two ways:
the end of the previous
if the others are not terminated
command1 command2
>command1 >command2
command1 command2
> command1 & > command2
command1 CTRL-Z fg
Run fg Run bg Blocked Shell
list the jobs
the job is forced in background
the job is forced in foreground
process id
user id of the user that executed the process
time corresponding to the begin of the execution
% ps -l S UID PID PPID TTY TIME COMD R 2103 1728 1676 ttys0 0:00 ps S 0 1675 110 ttys0 0:00 telnetd S 2103 1676 1675 ttys0 0:00 -csh
a non-tty
then execute them by calling the file
by the name of the shell (absolute path)
#!/bin/bash date who
(variable , value)
assign value to the variable
print the value of variablename
print all the variable