Launching shell scripts from different dirs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Launching shell scripts from different dirs
# 1  
Old 07-31-2010
Launching shell scripts from different dirs

Hi,

General question, if I have a shell script whcih I launch from anywhere on the system vis the PATH env var, how can I get the script to echo where I launch this from?

i.e. /my/home/script/myscript

BUT

I launch this from /my/otherarea/somewherelse via the env variable. I would like to echo where I actually am and not where my script is stored. I have tried pwd but this only gives me where the sscript is stored??

Thanks
# 2  
Old 07-31-2010
Hi.

You can use the pwd command, or the $PWD variable to see where you are when you launch the script.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Launching mplayer from within Links2 using a shell script

I'm using the Links2 console web browser in graphical mode (the "-g" argument), and launching a shell script that invokes MPlayer from within it. MPlayer works fine. No problem there. The problem, is that I have no control over the MPlayer process. I would like to be able to exit MPlayer whenever... (16 Replies)
Discussion started by: ignatius
16 Replies

2. UNIX for Dummies Questions & Answers

**HELP** how to do a listing of dirs and all sub dirs only

I am trying to get a listing of ALL directories only under /export (as an example). I can get all the dirs directly under /export but I need any sub dirs under those dirs. I've looked (here and google) but can not find anything that works (4 Replies)
Discussion started by: bbraml
4 Replies

3. Shell Programming and Scripting

Not correct processing of “\ “ in names of dirs inside shell script (tar command - system backup scr

Hello, Recently, I've started with shell scripting, and decided to write a script for my system backup using tar. When I was dealing with tar execution inside shell script I found this, inside shell we have the following code: tar $TAR_PARAMS $ARCHIVE_FILE $EXCLUDE $BACKUP_STARTwith... (6 Replies)
Discussion started by: ilnar
6 Replies

4. Shell Programming and Scripting

Launching shell from another

hi, I have shell script ( say A.sh) that launches another shell script ( say B.sh) on the server. In shell script A.sh, if i call B.sh as . B.sh <-- it doesnt work, err file not found . ./B.sh <-- it doesnt work, err file not found ./B.sh <-- works why so? BTW the file exists at the... (4 Replies)
Discussion started by: sjc
4 Replies

5. Shell Programming and Scripting

Launching a C program that needs input from a shell script

hi there, i need some help, i am trying to run a script to launch a C program and a Java program but before running both I want to get a user input and then invoke both programs with input received. In the programs the inputs are not command line arguments. This is the code, after the java... (4 Replies)
Discussion started by: momal
4 Replies

6. Shell Programming and Scripting

calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus, I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script. i m looking for something like this call 3.1; If 3.1 = "complete" then call 3.2; if 3.2 = ''COMPlete" then call 3.3; else exit The... (1 Reply)
Discussion started by: shashi369
1 Replies

7. Shell Programming and Scripting

Launching Several Shells....

Hi, I need to create a shell that launches several shells named for example svspush (that does nothing but wait) and record their pid in a file. Any inputs please. Thanks, Marconi (1 Reply)
Discussion started by: marconi
1 Replies

8. Shell Programming and Scripting

shell script to create dirs

hi, I would like to know of a shell script to create the following A script which will take in two parameters i.e. name of file and SID and create directories named /opt/oracle/admin/$SID/{bdump,cdump,udump}. Then edit the init file and change the three lines that look like this. ... (2 Replies)
Discussion started by: sjajimi
2 Replies

9. Shell Programming and Scripting

Launching a new bash shell

I'm new to programming on unix and have a really simple question (google hasn't been my friend today). I have a bash shell running on a remote machine. I'm looking at it from a windows PC using Exceed. Is there a command I can use from the shell which will launch another bash shell? Thanks! (3 Replies)
Discussion started by: gsd
3 Replies

10. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies
Login or Register to Ask a Question