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
/

4 comments:

Cindy Dy said...

I love this site! I could find all the information I needed in a split second! It's rare that you stumble upon excellent sites like this! Now this website resides in my favorites! Great job guys.

www.gofastek.com

forrest codilla said...

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

www.triciajoy.com

lee woo said...

Love it! Very interesting topics, I hope the incoming comments and suggestion are equally positive. Thank you for sharing this information that is actually helpful.


ufgop.org
ufgop.org

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.