[Gllug] print grep var in awk shell script?

Tethys tet at createservices.com
Fri Mar 5 14:30:36 UTC 2004


Richard Huxton writes:

>Or just "echo -n"

Or for better portability:

	echo 'abc\c' | grep c >/dev/null 2>&1
	if [ $? -eq 0 ]
	then
		e1='-n '
		e2=
	else
		e1=
		e2='\c'
	fi

	nonlecho()
	{
		echo $e1 "$@"$e2
	}

Then just call nonlecho to echo stuff without a newline. This will work
with both sysv and bsd style echo.

Tet
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list