[comp.unix.shell] Getting csh to preserve trailing blanks from backquoted commands.

jms@tardis.Tymnet.COM (Joe Smith) (09/29/90)

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."