RE: scripting problem
- From: "Broekman, Maarten" <Maarten.Broekman@xxxxxxx>
- Date: Mon, 28 Jan 2008 17:27:17 -0500
The "IFS" environment variable controls it. Thanks Serge for reminding
me of that.
IFS='
'
# original code
IFS=' '
That should do it, I think...
Maarten Broekman
-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx
[mailto:redhat-list-bounces@xxxxxxxxxx] On Behalf Of Steven Buehler
Sent: Monday, January 28, 2008 4:23 PM
To: 'General Red Hat Linux discussion list'
Subject: RE: scripting problem
How do you do that? Never heard of that before.
Steve
-----Original Message-----mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
From: redhat-list-bounces@xxxxxxxxxx [mailto:redhat-list-
bounces@xxxxxxxxxx] On Behalf Of Serge Dubrouski
Sent: Monday, January 28, 2008 3:13 PM
To: General Red Hat Linux discussion list
Subject: Re: scripting problem
One way would be to set IFS (Internal Field Separator) to CR before
your loop and restore it after it.
On Jan 28, 2008 2:00 PM, Aaron Bliss <abliss@xxxxxxxxxxxxx> wrote:
Steve,to
The easiest way to work around the space problem is to just use tar
backup the home directory.a little
Aaron
Steven Buehler wrote:
I am hoping that someone here can help me with this. I am running
that gets mescript that backs up some directories for me. Below is snippet
names. Wheninto trouble.
---------------------
#!/bin/sh
DIRSTOBACKUP=`/bin/ls -d1 /home/user/*`
for NAMEDIR in ${DIRSTOBACKUP[@]}
do
echo $NAMEDIR
done
---------------------
The problem is that some of the directories have spaces in the
So "Redrunning the for loop, it will take the new NAMEDIR at the space.
way aroundHat" would end up listing as 2 directories, "Red" and "Hat". Any
this?
Thanks
Steve
--
Aaron Bliss
Systems Administrator
SUNY Brockport
(585) 395-2417
--
redhat-list mailing list
unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
--
Serge Dubrouski.
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
- References:
- scripting problem
- From: Steven Buehler
- Re: scripting problem
- From: Aaron Bliss
- Re: scripting problem
- From: Serge Dubrouski
- RE: scripting problem
- From: Steven Buehler
- scripting problem
- Prev by Date: Re: scripting problem
- Next by Date: Re: scripting problem
- Previous by thread: RE: scripting problem
- Next by thread: Re: scripting problem
- Index(es):