Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-30-2010, 04:41 AM   #1
LQ Newbie
Registered: Jul 2010
Posts: 3

Rep: Reputation: 0
Can't source file by shell script in Ubuntu 10.04

Hi, Please advise

When I try to execute my script its getting error

......................................... 40: source: not found 41: source: not found 42: source: not found


But in Redhat I can run same script . My script as follows.


source $SCRIPT_HOME/conf/system.conf
source $SCRIPT_HOME/src/logging.bin
source $SCRIPT_HOME/src/tape_backup.bin


Please help me !!
Old 07-30-2010, 05:27 AM   #2
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92

I suspect that the source package isn't installed.

Try running the line below at the terminal and post the output:

$ source $SCRIPT_HOME/conf/system.conf
Obviously add in the full path for $SCRIPT_HOME.
Old 07-31-2010, 12:21 AM   #3
LQ Newbie
Registered: Jul 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Hi Yas,

I tried that way(gave absolute path) too. But Still error is the same

dhanushka@dhanushka-laptop:~/project/mChoise_Recharge/scripts/scriptfw/bin$ sh 40: source: not found

But I can source that file through command line .

dhanushka@dhanushka-laptop:~$ source /home/dhanushka/project/mChoise_Recharge/scripts/scriptfw/conf/system.conf
Old 07-31-2010, 08:43 AM   #4
Andrew Benton
Senior Member
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
source is a bashism. Ubunut uses dash as its /bin/sh. dash doesn't support source. If you want to use bash change the shebang at the top of your script to #!/bin/bash
If you want to make your scripts portable use . instead.

. $SCRIPT_HOME/conf/system.conf
. $SCRIPT_HOME/src/logging.bin
. $SCRIPT_HOME/src/tape_backup.bin
Old 08-08-2010, 07:35 AM   #5
LQ Newbie
Registered: Jul 2010
Posts: 3

Original Poster
Rep: Reputation: 0

Hi Andy ,

Its worked !!!!
Thank you very much


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to execute Source command in a shell script UltraSoul Linux - General 3 09-23-2010 11:13 AM
using source inside a shell script DEF. Programming 8 11-18-2009 06:52 PM
Tidy shell script source file mmn357157 Linux - General 8 12-20-2008 08:33 PM
Need a shell script to turn a lined file into a comma seperated file Thaidog Linux - General 8 03-08-2008 08:19 PM
Need a script to search and replace text in file using shell script unixlearner Programming 14 06-21-2007 11:37 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:58 PM.

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