Download your favorite Linux distribution at LQ ISO.
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-16-2004, 01:58 PM   #1
Registered: Jan 2002
Posts: 162

Rep: Reputation: 30
Stupid bash problem

Feduppa C2 Final ;-)

I need to get the text from a file to be passed into a shell script from another shell script. Each permutation I try fails, and I've never eally got to grips with this even though I know you guys eat & sleep it.

The first script is called
./ < `cat value.txt`

(thats my attempt at fixing it - it gives "no such file or directory")

The target script is called
echo processing $1

The file value.txt contains "bingo!"
So I just want to see "processing bingo!". Heeelp!!
Old 07-16-2004, 04:16 PM   #2
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
What you wrote works fine for me. Are you sure value.txt is in the same directory you're running the script from and is readable by your user?
Old 07-16-2004, 07:54 PM   #3
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Mr. ericcarlson,

I created your environment in my machine. When I started the script, I got
./ bingo!: no such file or directory
It's saying "the file bingo! does not exist". Lets see what happened. When you use the input redirector "<" you are saying to the shell read the contents of the file, in this case, "`cat value.txt`". Then, first the shell executes the redirection specified by the grave signals, substituting the expression by the resulting content. So, now you have a command like
./ < bingo!
This file doesn't exist. Besides you want to pass the file contents as a parameter to the You need to remove the redirector "<". So, your command, after the substitution will be
./ bingo!
I hope it helps.
Old 07-17-2004, 03:19 AM   #4
Registered: Jan 2002
Posts: 162

Original Poster
Rep: Reputation: 30

Thats it! I even understand it too - nice explanation.
Thanks for everyones help - this forum is too cool :->


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
Stupid, stupid question; I lost Klaptop. :( Surfrider Slackware 2 08-31-2005 10:12 PM
My Last Stupid Problem mtecknology Linux - Software 8 07-15-2005 04:32 PM
Stupid problem k1ll3r_x Linux - Hardware 4 01-06-2005 09:21 AM
stupid bash question tisleti Linux - Newbie 4 09-10-2004 06:34 AM
bash script - even more stupid question than last time. webamoeba Linux - Newbie 2 02-12-2004 04:03 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:43 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