🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by perf Sun, 02 Jul 1989 17:38
Whitespace not skipped in continued case pattern
#196
Author: perf
Date: Sun, 02 Jul 1989 17:38
65 lines
1919 bytes
Facts: Bash 1.01 compiled with gcc 1.35 on a Sun 3/280 running SunOS 4.0.1
	    
A newline in a case pattern seems to turn off skipping of whitespace
in the continuing line. Some examples:

---------------------------------
This doesn't work at all. 

	bash$ cat test1.sh
	case $SHELL in
	*csh | *ksh |\
	   *bash )
		echo xxxxxxxx ;;
	esac
	bash$ sh test1.sh
	xxxxxxxx
	bash$ bash -norc test1.sh
	syntax error near `*bash'
	in line 3: `   *bash )'
	syntax error near `;'
	in line 4: `    echo xxxxxxxx ;;'
	syntax error near `esac'
	in line 5: `esac'

---------------------------------
But if we break the line before the '|' it's ok.

	bash$ cat test2.sh
	case $SHELL in
	*csh | *ksh\
	   | *bash )
		echo xxxxxxxx ;;
	esac
	bash$ sh test2.sh
	xxxxxxxx
	bash$ bash -norc test2.sh
	xxxxxxxx

---------------------------------
Then put a blank before '\' and we're lost again...

	bash$ cat test3.sh
	case $SHELL in
	*csh | *ksh \
	   | *bash )
		echo xxxxxxxx ;;
	esac
	bash$ sh test3.sh
	xxxxxxxx
	bash$ bash -norc test3.sh
	in line 3: `   | *bash )'
	syntax error near `;'
	in line 4: `    echo xxxxxxxx ;;'
	syntax error near `esac'
	in line 5: `esac'

---------------------------------

Note that sh has no problems with any of the examples.

--
Per Foreby
System manager at EFD, Lund Institute of Technology (Lund University)
Snail: E-huset, Tekniska Hogskolan i Lund, Box 118, S-221 00 LUND, Sweden. 
Email: perf@efd.lth.se		Phone: int + 46 46-10 75 98
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