or:
strip=`expr $six + 0`
The wonderful thing about unix, 40 billion ways to do anything.
Eric Estabrooks wrote:
>
> 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
>
> _______________________________________________
> Twin Cities Linux Users Group Mailing List - Minneapolis/St. Paul, Minnesota
> http://www.mn-linux.org
> tclug-list at mn-linux.org
> https://mailman.mn-linux.org/mailman/listinfo/tclug-list
--
Wayne Johnson, | There are two kinds of people: Those
3943 Penn Ave. N. | who say to God, "Thy will be done,"
Minneapolis, MN 55412-1908 | and those to whom God says, "All right,
(612) 522-7003 | then, have it your way." --C.S. Lewis