I'm trying to execute the following command within a bash script:
Code:
tac /var/log/system.log | head -1
The script I wrote is:
Code:
#!/bin/bash
$test1="$(tac /var/log/system.log | -1)
echo $test1
When I run the script, this is the output I get:
Code:
Sat Feb 12 23:24:27 EST 2011
/var/log ->peterv@MBP17.local<528>$: but.sh
/Users/peterv/bin/but.sh: line 2: =Feb 12 23:57:54 MBP17 ReportCrash[14447]: Saved crash report for CapsSee[294] version 1.02 (1.01) to /Users/peterv/Library/Logs/DiagnosticReports/CapsSee_2011-02-12-235754_MBP17.crash: No such file or directory
Sat Feb 12 23:24:27 EST
The output in red above is what I'm expecting to be in variable $test1, but it looks as though it's trying to execute that text as a command. I'm assuming that there's some syntax I fouled up, but I can't see it. If anyone can help me out, I'd be very grateful.