The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Bourne Shell script - log for users loggin on and off noodlesoup Shell Programming and Scripting 14 09-08-2006 07:30 PM
Bourne: How to invoke an alias from within a shell script techshots Shell Programming and Scripting 2 06-03-2006 09:38 PM
Bourne Shell Script dmhonor914 UNIX for Dummies Questions & Answers 2 12-10-2003 09:25 AM
bourne shell script psrinivas Shell Programming and Scripting 2 12-06-2001 12:38 PM
Bourne shell script need help please ? dezithug UNIX for Advanced & Expert Users 7 10-24-2001 10:59 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 05-23-2006
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,638
Quote:
Originally Posted by System Shock
While I don't understand exactly why you need a script to issue a cd command, why just not create an alias? As in

Code:
 alias 'cdv=cd /des/proj/$1'

If you read the thread you will see that the question relates to bourne shell, bourne shell does not have aliases.
Reply With Quote
Forum Sponsor
  #9  
Old 05-24-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,297
Do you want the user to exit your script and be in the correctory directory?

Then source your script. ie., (note the leading dot)
Code:
. /path/to/script.sh
If you are invoking shells ie.,
the first line is
Code:
#!usr/bin/sh
then this idea will not work because everytime the user calls the script he execs another shell. Get rid of it. In a sourced script you also should not call exit at the end of the script.
Reply With Quote
  #10  
Old 05-24-2006
System Shock's Avatar
Registered User
 

Join Date: May 2006
Location: Tau Ceti V
Posts: 395
Quote:
Originally Posted by reborg
If you read the thread you will see that the question relates to bourne shell, bourne shell does not have aliases.
If you read the title you will see that the question relates to a bourne shell SCRIPT. I suggested an alias in the users' environment, not in the script. I have no idea what other users use as login shells. Why would I suggest set an alias in a script to begin with, especially when, even if the script was ksh or csh, it would do what he wants???
Reply With Quote
  #11  
Old 05-25-2006
Registered User
 

Join Date: May 2006
Posts: 10
Hi Jim,

BTW Great advice, thank you.

So if i understand you right you right, i will end up with a pretty complex .cshrc file. Which is fine by me !

The fact is i just thought there might be a simple way to get control of the shell where the script was initiated. I guess NOT !

Cheers Jim and to everyone for your kind support and valuable time.

FMA
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0