Results 1 to 3 of 3
Hi all
I have a question related with variables. Let's assume that I have one .txt file in my /tmp directory. Look here:
#!/bin/sh
var='/tmp/*.txt'
echo var
I'm getting
/tmp/file.txt
...
- 02-16-2009 #1Just Joined!
- Join Date
- Jan 2007
- Posts
- 9
echo $var Problem
Hi all
I have a question related with variables. Let's assume that I have one .txt file in my /tmp directory. Look here:
#!/bin/sh
var='/tmp/*.txt'
echo var
I'm getting
/tmp/file.txt
That's ok
Now I want the file name to be displayed in this sitaution to :
echo "file=>$var"
It shows
file=>/tmp/*.txt
But I want it to be shown as
file=>/tmp/file.txt
How can I solve it?
Thanks ...
- 02-17-2009 #2Linux User
- Join Date
- Jan 2006
- Posts
- 414
tried removing the quotes?
- 02-18-2009 #3
So you want
to showCode:#!/bin/sh var='/tmp/*.txt' echo var
... how about you change to:Code:file=>/tmp/file.txt
You are, after all, echoing out a literal variable here.Code:#!/bin/sh var='/tmp/file.txt' echo var
Linux user #126863 - see http://linuxcounter.net/


Reply With Quote