LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-30-2014, 11:39 AM   #1
Frustin
Member
 
Registered: May 2002
Location: Essex, UK
Distribution: Debian, Redhat, AIX 5L
Posts: 512

Rep: Reputation: 30
Question pass path from one script into another


in my bash script i have:

Quote:
sh /opt/path/to/dir/installproducts.sh
the contents of installproducts.sh:

Quote:
#!/bin/sh
php install_products.php all
When i run installproducts.sh within my script it says:

Quote:
Could not open input file: install_products.php
I can run it on the command line, just not in my bash script.

i'm assuming this is because the the full path of install_products.php isnt specified. The trouble is I can not do that as that script is not mine and is downloaded. I'm just trying to run it from my bash script. Is there a way around this please?
 
Old 06-30-2014, 11:45 AM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Probably something like this:

Code:
(cd /opt/path/to/dir/; sh ./installproducts.sh)
The parens indicate a subshell so it doesn't change directory in the main script.
 
  


Reply



Posting 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



Similar Threads
Thread Thread Starter Forum Replies Last Post
script to read path from console and used to change the script execution path vdamgo Linux - General 5 02-12-2013 02:18 PM
how to pass MySQL user/pass securely in shell script? digity Linux - Newbie 5 01-07-2010 05:48 AM
Need help writing Unix Shell script to pass file name,path,creation date ! windjashi Programming 4 10-08-2009 12:59 AM
bash script path issue - how to pass a path as a string to a variable PiNPOiNT Programming 5 04-17-2009 05:48 PM
Shell script help: How to pass a directory path to the script? dv502 Programming 13 09-10-2008 03:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration