Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 1997 12:04:36 -0700 (PDT)
From:      "Jin Guojun[ITG]" <jin@adv-pc-1.lbl.gov>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/3387: sh mis-interpret the file name / awk failure
Message-ID:  <199704251904.MAA00477@adv-pc-1.lbl.gov>
Resent-Message-ID: <199704251910.MAA05199@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         3387
>Category:       bin
>Synopsis:       sh mis-interpret the file name / awk failure
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 25 12:10:01 PDT 1997
>Last-Modified:
>Originator:     Jin Guojun[ITG]
>Organization:
/-------------- Jin Guojun ------------ v -- Internet: j_guojun@lbl.gov ---\
|	Imaging & Distributed Computing | Usenet: ucbvax!j_guojun@lbl.gov  |
|	Lawrence Berkeley Laboratory	| Bitnet:	--		   |
|	50B-2239, Berkeley, CA 94720	-  jin%george.lbl.gov@Csa3.LBL.Gov |
\--Ph#:(510) 486-7531 + Fax: 486-6363 --^--http://www-itg.lbl.gov/ITG.html-/
>Release:        All FreeBSD RELEASE i386
>Environment:

	All FreeBSD RELEASEs

>Description:

	In a script, if the variable for a file name had a white space at
	the end, the sh will treat it differently when the file name variable
	is used at redirected I/O, from used at fopen(). The white space is
	interpreted as part of the file name when I/O redirections, such as,
	'<', '<<', '>>', and '>' are used. This is a problem for using in
	a script.
	The FreeBSD awk generates such withe space:

		MyArch=`uname -v | awk -F/ '{printf $NF}`
		echo	"=$MyArch="
		=GENERIC =

	I am not sure which one is the problem, maybe both.

>How-To-Repeat:

	For awk problem, see Description above.
	Below is the sh issue:

	% more abc
	file abc is a testing file

	% more test.script
	FILE_NAME="abc "
	more < $FILE_NAME
	echo	"=$FILE_NAME="
	more $FILE_NAME

	% test.script
test.script: cannot open abc : no such file
=abc =
file abc is a testing file


>Fix:
	
	one of them has to be fixed, but I do know which (-:
	Maybe both?

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704251904.MAA00477>