[10236] in Athena Bugs

home help back first fref pref prev next nref lref last post

decmips 7.4G: csh

daemon@ATHENA.MIT.EDU (gptesler@Athena.MIT.EDU)
Sun Jan 31 10:10:43 1993

From: gptesler@Athena.MIT.EDU
To: bugs@Athena.MIT.EDU
Date: Sun, 31 Jan 93 10:10:38 EST

System name:		w20-575-41
Type and version:	KN02ca 7.4G
Display type:		PMAG-DV 

What were you trying to do?
	Get the tail of the name used to call a script.

What's wrong:
	$0:t and ${0:t} do not give the tail of the name.
	If the name were "/mit/gptesler/blah/foo", $0:t would
	yield "/mit/gptesler/blah/foo:t" and ${0:t} would
	print "Variable syntax."
	If this were the first argument to the script, however,
	both $1:t and ${1:t} would return the correct answer, "foo".
	I can bypass the problem by doing something like
			set progname=$0
	and then using $progname:t to get the tail.
	Similar problems occur with other colon modifiers on argument 0.

What should have happened:
	The modifiers should work as documented in the csh man page.

Please describe any relevant documentation references:
	The csh man page describes various metasequences
		$name ${name} $name[selector] ${name[selector]}
		$#name ${#name} $0 $number ${number} $*
	and then says

>     The modifiers `:h', `:t', `:r', `:q' and `:x' may be applied to the sub-
>     stitutions above as may `:gh', `:gt' and `:gr'.  If braces `{' '}'
>     appear in the command form then the modifiers must appear within the
>     braces.

	It then continues on to describe sequences which may not be modified
	with colon modifiers,
		$?name ${?name} $?0 $$ $<

home help back first fref pref prev next nref lref last post