Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Creating a shell script HELP

Creating a shell script HELP
Thread Tools
Dedicated MacNNer
Join Date: Nov 2002
Location: Vancouver, Canada
Status: Offline
Reply With Quote
Oct 11, 2003, 03:31 PM
 
Hey,
I am learning to write some shell scripts and am running into a problem when I want to use tha alias command...

I include the line:
"alias ll /bin/ls -l"
but get an error saying that it can't find ll and it can't find ls...

What am I doing wrong? Other commands like ls or rm or echo etc. all work fine... it's just alias that's not working.

Any help would be appreciated.

Doc Holiday
Powerbook 15.2" G4 1.5Ghz
1GB RAM, 80GB 5400rpm
4GB iPod Mini, Rev 2, Green
     
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Oct 11, 2003, 10:11 PM
 
For Jaguar, which has tcshrc as its interactive shell,

alias ll 'ls -l'

alias lm 'ls -al | more'

Single quotes encase the command that is aliased if there are parameters or more than just the command.

HTH
Craig
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Oct 13, 2003, 08:28 AM
 
Originally posted by docholiday:
Hey,
I am learning to write some shell scripts and am running into a problem when I want to use tha alias command...
Aliases are very useful in the interactive shell. They are not typically used in shell scripts however. Usually, an environment variable is used in a shell script instead.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:43 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2