UNIX WK 6

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Week 5 Fab 9 2023

#!/bin/bash - she-bang
which bash - /bin/bash
which perl - /usr/bin/perl

$PATH - lists of directory


absolute path - entire path

.. parent directory
pwd
/home/u301263435/work
cd ../../../
pwd output: /

. current directory
./sctipt - ./ -means look up the file in the current directory

user excute permission:


chmod 0764 script.sh
echo $?
0

$0 $1 $2 etc - positional arguments


1 #!/bin/bash
2 echo Hello world
3 echo $1
4 exit 0

u301263435@s301263435:~/work$ ./script.sh
Hello world

u301263435@s301263435:~/work$ ./script.sh pwd


Hello world
pwd

u301263435@s301263435:~$ _MSG="Goodbye cruel world" ; echo $_MSG


Goodbye cruel world
u301263435@s301263435:~/work$ ./script.sh $_MSG
Hello world
Goodbye

You might also like