🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1271

Re: Getting csh to preserve trailing blanks from backquoted commands.

#1271
From: Joe Smith
Date: Fri, 28 Sep 1990 19:53
15 lines
1315 bytes
In article <1243@romana.Tymnet.COM> I ask:
>How do you pad a csh variable to specific length using trailing blanks?

Answer: Use double quotes when setting the variable, and when referencing it.

Part of it was a blind spot in my thinking.  I had convinced myself that
	set who="`expr substr '$USER        ' 1 8`"
would not work since the $USER was inside single quotes.  That was wrong.
Due to the surrounding double quotes, "'" is treated as an apostrophe; just
another printing character at the time variable substitution takes place.
-- 
Joe Smith (408)922-6220 | SMTP: jms@tardis.tymnet.com or jms@gemini.tymnet.com
BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms
PO Box 49019, MS-C41    | BIX: smithjoe | 12 PDP-10s still running! "POPJ P,"
San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga 3000 speaks for me."
Technical Details
Message-ID: <1251@tardis.Tymnet.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!olivea!tymix!tardis!jms
References: <1243@romana.Tymnet.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!olivea!tymix!tardis!jms
From: jms@tardis.Tymnet.COM (Joe Smith)
Newsgroups: comp.unix.shell
Subject: Re: Getting csh to preserve trailing blanks from backquoted commands.
Message-ID: <1251@tardis.Tymnet.COM>
Date: 28 Sep 90 19:53:40 GMT
References: <1243@romana.Tymnet.COM>
Reply-To: jms@tardis.Tymnet.COM (Joe Smith)
Organization: BT Tymnet, San Jose, CA
Lines: 15