![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| short notice | gummiworm | UNIX for Dummies Questions & Answers | 2 | 03-24-2006 01:46 AM |
| cdrom, short file name | MuellerUrs | SUN Solaris | 3 | 01-22-2006 11:45 AM |
| short script help | jodders | Shell Programming and Scripting | 8 | 02-17-2004 07:19 AM |
| short banner | RoMaGo | UNIX for Dummies Questions & Answers | 2 | 03-25-2003 07:06 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Short cut for su and cd ?
Situation:
I've logged in as ordinary_user1; I can su to common_dev_user; When I su to common_dev_user, I'm taken to the HOME dir of common_dev_user; Everytime I need to cd to a particular folder from here (say like cd /developers/ordinary_user1/code/) This is a repetitive task (su ing and cd to the fixed path mentioned). Requirement: From my user id ordinary_user1, I need a short cut to su to common_dev_user and cd to this directory. Is this possible? |
| Forum Sponsor | ||
|
|
|
|||
|
First of all, "su" doesn't ordinarily change your directory - "su -" does. Check "man su"..
But you may need the environment for other reasons. If so, put a shell script in common_dev_user's home directory: #!/bin/bash # this is "thescript" cd /wherever-you-like bash Then invoke the su like this: su - common_dev_user ./thescript That causes them to run "thescript" in their home directory which cd's to where you want and starts another shell. Have you thought about using "sudo" instead for whatever it is you need to do? Using sudo |