Re: bash related question, adding variable into path
On Sat, 23 Jun 2012 12:14:39 +0800, Umarzuki Mochlis wrote:
> 2012/6/22 Camaleón <noelamac@gmail.com>:
>> On Fri, 22 Jun 2012 12:34:40 +0800, Umarzuki Mochlis wrote:
>
>>> #!/bin/bash
>>> echo "Username? then [ENTER]:"
>>> read username
>>> id=`/opt/zimbra/bin/mysql -e 'use zimbra;select id,comment from mailbox;' | grep $username | cut -f 1`
>>> mkdir /tmp/$username 2>/dev/null
Put an echo here.
>>> for i in `egrep '(1[8-9]|2[0-2]) Jun 2012'
>>> /opt/zimbra/store/0/$id/msg/0/* | cut -d : -f 1 | uniq`
And another flag here.
>>> do
>>> cp $i /tmp/$username
And just in case, also print the value of $username to track all the
variables used in the script.
>>> done
>>>
>>> there must be something that i had missed...
>>
>> Print/echo the $id variable to check for its current value as seen in
>> runtime by your script :-?
>
>
> i had checked with echo that $id indeed output a id and running
Care to send the output of the script when you run it once you added the
echo lines? :-)
> if i put the id value exactly as output of "/opt/zimbra/bin/mysql -e
> 'use zimbra;select id,comment from mailbox;' | grep $username | cut -f
> 1", it worked
So you mean the whole script works okay.
> what else could should i look for?
I don't know... need more data.
Greetings,
--
Camaleón
Reply to: