Re: variable lost when while loop piped

2007-06-03 Thread Ed L. Cashin

On 6/2/07, Paul Jarc <[EMAIL PROTECTED]> wrote:

[EMAIL PROTECTED] wrote:
>   A variable set inside a while loop loses its value if
>   the while loop is piped to a command, e.g., sed.

This is normal.  Read entry E4 in the bash FAQ.


Thank you for the reminder.  Sorry for the noise.

--
 Ed L. Cashin <[EMAIL PROTECTED]>


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Please exclude ".." and "." in path completion of ".*"

2007-06-03 Thread Manuel Reimer
Hello,

yesterday, I tried to just change the owner of a user profile. So I used "cd" 
to get directly into the user directory and used this command, at first:

chmod -R $USERNAME *

Unfortunately there have been "dot files" in the user profile and so I tried 
this command to catch them:

chmod -R $USERNAME .*

I didn't know, that this command also catches ".." and so chmod started to 
chmod all user profiles... and so some users couldn't access their files for 
several hours...

Of course, I could have used something like

chmod -R $USERNAME /home/$USERPROFILE

but shouldn't it be possible to "just catch all files and directories in the 
current directory" using pattern matching?

Another example: How would I kill all files on a mounted removable media?

I would try to cd into the mountpoint and use the command

rm -rf * .*

If this also catches the "..", this would kill all files on my mounted drives 
in /mnt.

I think it would be a pretty good idea to modify bash to not catch ".." and "." 
if someone wants to match ".*". Noone really wants ".." or "." to be matched in 
this case, and for those, who want this, it would be possible to add a new 
shopt option.

Thank you very much in advance for your answer. It would be great if someone 
could create the needed patch, as I would need several days or weeks to create 
it on my own. If you don't have the required time to fix this issue, then 
please at least tell me if you would accept a patch for this issue. If you 
would accept a patch, I'll start to create one to send it in.

Yours

Manuel Reimer
-- 
Pt! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: Please exclude ".." and "." in path completion of ".*"

2007-06-03 Thread Andreas Schwab
"Manuel Reimer" <[EMAIL PROTECTED]> writes:

> Hello,
>
> yesterday, I tried to just change the owner of a user profile. So I used "cd" 
> to get directly into the user directory and used this command, at first:
>
> chmod -R $USERNAME *
>
> Unfortunately there have been "dot files" in the user profile and so I tried 
> this command to catch them:
>
> chmod -R $USERNAME .*

You could have just used "." as the argument.  Saves a key. :-)

> Another example: How would I kill all files on a mounted removable media?

rm -rf * .[!.]* ..?*

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash