Monday, January 25, 2010

Difference between Unix Internal & External Commands

Internal Unix commands are built with the shell and hence it will run in the same shell.
eg: cd

External Unix commands will start a new shell and then it gets executed
eg: ls

Note: If you execute a shell script, it will create or fork a new shell and then execute the commands present in the script file. You can also execute the shell script in the same shell by using source or . infront of the shell script.

eg:
sujay@laptop:~/scripts$ cat test.sh
cd /
echo "Current dir is `pwd`"

sujay@laptop:~/scripts$ test.sh
Current dir is /
sujay@laptop:~/scripts$ pwd
/home/sujay/scripts
sujay@laptop:~/scripts$ source test.sh
Current dir is /
sujay@laptop:/$ pwd
/

2 comments:

Unknown said...

i'm impressed! an attention-grabbing blog post.

www.triciajoy.com

ERP said...

Oracle fusion HCM Training from ERPTREE gives you the best results to learn your dream course and maintains sufficient knowledge on oracle. It provides training by self-paced videos which are very helpful for the users to watch at any time according to their schedule. It is globally accepted and having many users undergoing training every day.