Launching shell from another


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Launching shell from another
# 1  
Old 02-25-2011
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 right place
# 2  
Old 02-25-2011
the dot (period) means "in the current working directory". So ./B means "execute B which is in the current working directory". You can use it with other commands too such as find.
Code:
find . -type  f

Find in the current working directory all files.

If I'm in /home/dcslick/ and I have slick.sh in that directory, the . expands to /home/dcslick/ in the shell. ./slick.sh = /home/dcslick/slick.sh in this example. / means the root directory. As long as your file is executable and in the current working directory (the one your shell is currently in) you can type: ./ followed immediately by the file name to execute it.
# 3  
Old 02-25-2011
thanks, bu i want to know why it doesnt work with . B.sh ?
# 4  
Old 02-25-2011
not proper syntax... the . needs a / after it. Files starting with a . are hidden files. So .B is a legit file name. Filenames can have spaces in them too. So: [SPACE]B is a legit name too, just not an advisable one. You have to specify ./ which says "Current working directory"
# 5  
Old 02-25-2011
What shell are you using?
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. Ubuntu

Launchers Not Launching

Some of my .desktop launchers aren't working. When I try to execute it from the main menu nothing happens. When I try to launch it from a terminal I get the following: $ /usr/share/applications/qjoypad.desktop /usr/share/applications/qjoypad.desktop: line 1: Here are the contents of the launcher:... (0 Replies)
Discussion started by: Deluge
0 Replies

3. Red Hat

Help in launching firefox.

Hi, -- I am new to linux, please bear with my tech terms. I am using Red Hat 4.1.2-48 (Linux version 2.6.18-194.11.1.el5) for the project. This is a remote server and I do not use any GUI. Now I need to install a product that requires me to launch firefox from linux. when i am trying... (3 Replies)
Discussion started by: vj8436
3 Replies

4. AIX

Error launching c++ executable

Hi everybody, I have compiled my code based on the ALPS libraries () and CMake build system with IBM compiler xlC 11.1 on AIX 6.1 at the latest patch level running on an IBM SP Power 6 machine for high-performance computing. When I run the executable I receive this error message: -bash-3.2$... (2 Replies)
Discussion started by: JessicaAlfonsi
2 Replies

5. Shell Programming and Scripting

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... (1 Reply)
Discussion started by: cyberfrog
1 Replies

6. Shell Programming and Scripting

Record PID when launching

I would like to record the PID of a process when i lauch it from my script something like: #/bin/bash $abc_pid = /apps/abc/abc.bin -port6700 I know I can run the ps command and grep for abc.bin. The idea is that becase the process runs on several ports and the argument list of .bin is... (2 Replies)
Discussion started by: yankee428
2 Replies

7. 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

8. UNIX for Dummies Questions & Answers

launching script via REXEC

Hi folks! my client uses an winapplication which is launching shell-scripts remotely on a HP-Unix Machine via Rexec. The application-configuration is launching the script (which is in the home directory of connecting user) like: rexec host user pass shell.sh So far so good, everything... (3 Replies)
Discussion started by: JohnMurdoch
3 Replies

9. 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

10. 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
Login or Register to Ask a Question