Thread View: comp.unix.shell
3 messages
3 total messages
Started by Martha S. DasSarma
Wed, 24 Oct 1990 21:44
using set in a csh script
Author: Martha S. DasSarma
Date: Wed, 24 Oct 1990 21:44
Date: Wed, 24 Oct 1990 21:44
24 lines
825 bytes
825 bytes
I am trying to do set a variable that includes spaces, but the set deletes them. I type: $ set t="Mon 5" $ echo $t $ Mon 5 What happens is that the set deletes the extra spaces I put in the set. How could I preserve the spaces? Any help will be appreciated. Thanks, Martha DasSarma ------ Martha DasSarma, Research Computing Facility, COINS, UMass/Amherst internet: martha@cs.umass.edu
Re: using set in a csh script
Author: Jonathan I. Kamens
Date: Wed, 24 Oct 1990 23:18
Date: Wed, 24 Oct 1990 23:18
19 lines
1109 bytes
1109 bytes
In article <21752@dime.cs.umass.edu>, martha@cs.umass.edu (Martha S. DasSarma) writes: |> What happens is that the set deletes the extra spaces I put |> in the set. Wrong. The spaces are not deleted when you do the set, they are deleted when you do the echo, since the echo command echoes each of its arguments, separating each of them by one space. % set t="Mon 5" % echo $t Mon 5 % echo "$t" Mon 5 -- Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710
Re: using set in a csh script
Author: Michael Salmon
Date: Thu, 25 Oct 1990 07:33
Date: Thu, 25 Oct 1990 07:33
19 lines
987 bytes
987 bytes
In article <21752@dime.cs.umass.edu> martha@cs.umass.edu (Martha S. DasSarma) writes: > > I am trying to do set a variable that includes spaces, but the > set deletes them. > I type: > > $ set t="Mon 5" > $ echo $t > $ Mon 5 > > What happens is that the set deletes the extra spaces I put > in the set. > How could I preserve the spaces? Set hasn't deleted the spaces, they were deleted in the parsing of echo, just as if you typed $ echo Mon 5. Try $ echo "$t". Regards Michael Salmon
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads