UNIX WK 6 Notes

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

source code
interpretted language - perl, python
-not prepared immediatley for execution

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

$PATH - lists of directory


absolute path - entire path
relative path - search in google

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

. current directory
./sctipt - ./ -means lookup the file in the current directory

chmod -x <script> - execute permission

set nu

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 worl" ; echo $_MSG


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

You might also like