Re: [Linuxcommand-discuss] question about redirection
Brought to you by:
bshotts
From: William S. <bs...@pa...> - 2004-02-11 17:57:31
|
I see your problem. See my comment below... ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org On Wed, 11 Feb 2004, Bram Mertens wrote: > On Wed, 2004-02-11 at 15:51, William Shotts wrote: > > Yes, by all means you would want to use a variable instead. It would make > > your script easier to maintain. I would suggest that in keeping with > > convention, the name of the variable should have an uppercase name since > > it you are treating the variable as a constant. > > After editing the script I get the following errors: > m8ram@linux:~> bin/startevo > bin/startevo: line 3: =/data/logs/evolution.log: No such file or directory > bin/startevo: line 4: $LOGFILE: ambiguous redirect > bin/startevo: line 5: $LOGFILE: ambiguous redirect > bin/startevo: line 6: $LOGFILE: ambiguous redirect > > This is what the script looks like now: > m8ram@linux:~> cat bin/startevo > #!/bin/bash > > $LOGFILE="/data/logs/evolution.log" This is wrong. It should be: LOGFILE="/data/logs/evolution.log" No leading "$". $ tells bash to perform a substition. It does not indicate a variable type as it would in say VisualBasic. Also, I assume that /data/logs exists and you have permission to read/write a file in that directory. > echo "" >> $LOGFILE > echo "--- $(date +"%R %A, %B %-d, %Y") ---" >> $LOGFILE > evolution >> $LOGFILE 2>&1 > > The file does exist and is writable: > m8ram@linux:~> ls -lh /data/logs/evolution.log > -rw-r--r-- 1 m8ram users 50K 2004-02-11 16:58 /data/logs/evolution.log > > Why is bash looking for a file called '=/data/logs/evolution.log' ? The > quotes are correct, aren't they? > > TIA > -- > # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # > # SuSE 8.2 Pro kernel 2.4.20-4GB i686 128MB RAM # > # 5:06pm up 19 days 20:43, 5 users, load average: 0.56, 0.20, 0.10 # > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Linuxcommand-discuss mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxcommand-discuss > |