Brian wrote:
> This should be an easy one, but for some reason I can't find the docs I
> need. In a bash script, how do you store the return of a program into a
> variable? For instance, I have a dat file:
> 001
> 002
> 003
> 004
> 005
> 006
> I want to store the 006 into $six. I thought I could do something like:
>
> six=tail -n1 numbers.dat
when you want the output of a command you need to use back quotes.
#!/bin/sh
six=`tail -n1 numbers.dat`
strip=${six//0}
echo "$strip"
Eric