07-02-2005
For a start, your slashes are the wrong way round, but I'll assume that's a typo
Anyway, having
`ls /foo/bar/*.txt`
will result in a lot of "not found" errors. This is not the way to use command substitution.
my_variable=`ls /foo/bar/*.txt` will work fine.
In your script, just use
ls /foo/bar/*.txt
and it should work fine.
If you're still having problems, please post your entire script.
Cheers
ZB
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello.
Consider the following magic words:
# ls `which adduser`
ls: /usr/sbin/adduser: No such file or directory
#
Hmmm...
Then:
# ls /usr/sbin/adduser
/usr/sbin/adduser
#
Now what?
Unforunately this little sniippet is used in my debian woody server's mysql pre install script.... (2 Replies)
Discussion started by: osee
2 Replies
2. UNIX for Dummies Questions & Answers
Portion of my script below :
if ; then
NUMBEROFFEILDS=`cat ${BASE_SCRIPT_LOC}/standardfilecleanup.lst|grep -w ${db_file_path}|awk -F: '{print NF}'`
COUNT=4
while ; do
awk_var="$"`echo $COUNT`
file_name1=`cat ${BASE_SCRIPT_LOC}/standardfilecleanup.lst|grep -w... (1 Reply)
Discussion started by: findprakash
1 Replies
3. OS X (Apple)
I've been trying to figure this out since last night, and I'm just stumped. The last time I did any shell scripting was 8 years ago on a Unix box, and it was never my strong suit. I'm on a Mac running Leopard now. Here's my dilemma - hopefully someone can point me in the right direction.
I'm... (10 Replies)
Discussion started by: Daniel M. Clark
10 Replies
4. Red Hat
Hi,
I need to write a Linux shell script which will perform an FTP operation to another server.
main.sh will contain -
ftp -nd Dest.IP.address < ftpScript.sh
Contents of ftpScript.sh is given below -
user userid passwd
prompt
lcd /vidya/Input
cd vidya/Output
mput *.*
close
... (1 Reply)
Discussion started by: vidyak
1 Replies
5. Shell Programming and Scripting
total=0
seq 1 5 | while read i ; do
total=$(($total+$i))
echo $total
done
echo $totalThis outputs:
1
3
6
10
15
0whereas I am expecting:
1
3
6
10
15
15My bash version: (4 Replies)
Discussion started by: meharo
4 Replies
6. UNIX for Dummies Questions & Answers
I need to sort through a volume that contains video files by access time and delete files that have not been accessed over x days. I have to use the access time as video files are originals that do not get modified, just read
Testing commands on a local test folder...
$ date
Wed Sep 28... (10 Replies)
Discussion started by: canon273
10 Replies
7. Shell Programming and Scripting
for i in `cat /export/home/afahmed/Arrvial_time.txt`
do
echo $i
echo $i | awk '$3 < $D { print $4 }' >> dynamic_DF.txt;
done
When i echo, its echo as
Nov
15
02:24
/export/home/pp_adm/inbound//wwallet_20111115.txt where i expect it to be Nov 15 02:24... (7 Replies)
Discussion started by: afahmed
7 Replies
8. UNIX for Dummies Questions & Answers
Hi. I am trying to start a script on my router that will execute even if i log off. To execute the script I write:
nohup ./dslconnection > dslstat.out 2>&1 &
It starts the job:
21968 admin 1604 S /bin/ash ./dslconnection
The problem is that when I log back in the job has been... (6 Replies)
Discussion started by: sebcou
6 Replies
9. Shell Programming and Scripting
Hi,
I have prepared a script and trying to execute it but not getting expected output. Could you please help and advise what is going wrong.
"If else" part in below script is not working basically.
I am running it on HP-UX.
for i in slpd puma sfmdb
do
echo "******\t$i\t*******"
echo... (10 Replies)
Discussion started by: sv0081493
10 Replies
10. UNIX for Advanced & Expert Users
I ran into the following and still do not understand entirely the rationale behind this. If someone could explain why things are as they are I'd be thankful.
The following was tested on AIX 7.1 with ksh88, but i suspect that to be ubiquitous. In an installation routine i had to create a set of... (6 Replies)
Discussion started by: bakunin
6 Replies
LEARN ABOUT DEBIAN
mojo::asset::file
Mojo::Asset::File(3pm) User Contributed Perl Documentation Mojo::Asset::File(3pm)
NAME
Mojo::Asset::File - File storage for HTTP 1.1 content
SYNOPSIS
use Mojo::Asset::File;
# Temporary file
my $file = Mojo::Asset::File->new;
$file->add_chunk('foo bar baz');
say 'File contains "bar"' if $file->contains('bar') >= 0;
say $file->slurp;
# Existing file
my $file = Mojo::Asset::File->new(path => '/home/sri/foo.txt');
$file->move_to('/yada.txt');
say $file->slurp;
DESCRIPTION
Mojo::Asset::File is a file storage backend for HTTP 1.1 content.
ATTRIBUTES
Mojo::Asset::File inherits all attributes from Mojo::Asset and implements the following new ones.
"cleanup"
my $cleanup = $file->cleanup;
$file = $file->cleanup(1);
Delete file automatically once it's not used anymore.
"handle"
my $handle = $file->handle;
$file = $file->handle(IO::File->new);
File handle, created on demand.
"path"
my $path = $file->path;
$file = $file->path('/home/sri/foo.txt');
File path used to create "handle", can also be automatically generated if necessary.
"tmpdir"
my $tmpdir = $file->tmpdir;
$file = $file->tmpdir('/tmp');
Temporary directory used to generate "path", defaults to the value of the "MOJO_TMPDIR" environment variable or auto detection.
METHODS
Mojo::Asset::File inherits all methods from Mojo::Asset and implements the following new ones.
"add_chunk"
$file = $file->add_chunk('foo bar baz');
Add chunk of data.
"contains"
my $position = $file->contains('bar');
Check if asset contains a specific string.
"get_chunk"
my $chunk = $file->get_chunk($start);
Get chunk of data starting from a specific position.
"is_file"
my $true = $file->is_file;
True.
"move_to"
$file = $file->move_to('/home/sri/bar.txt');
Move asset data into a specific file and disable "cleanup".
"size"
my $size = $file->size;
Size of asset data in bytes.
"slurp"
my $string = $file->slurp;
Read all asset data at once.
SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.
perl v5.14.2 2012-09-05 Mojo::Asset::File(3pm)