Re: unexpected operator .sh error
On Mon 31 May 2010 at 19:58:41 PDT Aiza wrote: Chris Hill wrote: On Tue, 1 Jun 2010, Aiza wrote: Added some code to a .sh script. When I run the script works but issues this message [: =: unexpected operator No line number telling where to look. I am not ever sure its talking about. IS [: whats wrong or =: I'd guess that what you added includes something like if [ x=y ] ... The open-square-bracket, [, is another name for test. IIRC the equal sign is not valid in that context. Can you post the 'before' and 'after' versions of that part of your script? It would help us in determining what the problem is. -- Chris Hill ch...@monochrome.org That hint got me to the correct line I hadif [$1 = "basejail" ]; then You need a space after the opening [ or it doesn't parse correctly. As Chris said, it's another name for test, so think of it as a word, i.e., something delimited by whitespace. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: unexpected operator .sh error
On Tue, 01 Jun 2010, Aiza wrote: > Chris Hill wrote: > >The open-square-bracket, [, is another name for test. IIRC the > >equal sign is not valid in that context. Using '=' within test(1) brackets should be fine. > >Can you post the 'before' and 'after' versions of that part of > >your script? It would help us in determining what the problem is. > > That hint got me to the correct line > > I hadif [$1 = "basejail" ]; then As noted by Chris and the sh(1) man page, '[' is a built-in equivalent of test(1). The correct syntax for an expression inside those brackets requires *spacing*, i.e. [ expression ], and not [expression ], as in your example. -- Sahil Tandon ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: unexpected operator .sh error
Chris Hill wrote: On Tue, 1 Jun 2010, Aiza wrote: Added some code to a .sh script. When I run the script works but issues this message [: =: unexpected operator No line number telling where to look. I am not ever sure its talking about. IS [: whats wrong or =: I'd guess that what you added includes something like if [ x=y ] ... The open-square-bracket, [, is another name for test. IIRC the equal sign is not valid in that context. Can you post the 'before' and 'after' versions of that part of your script? It would help us in determining what the problem is. -- Chris Hill ch...@monochrome.org That hint got me to the correct line I hadif [$1 = "basejail" ]; then I changed it to if $1 = "basejail"; then and got error msg =: not found ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: unexpected operator .sh error
On Tue, 1 Jun 2010, Aiza wrote: Added some code to a .sh script. When I run the script works but issues this message [: =: unexpected operator No line number telling where to look. I am not ever sure its talking about. IS [: whats wrong or =: I'd guess that what you added includes something like if [ x=y ] ... The open-square-bracket, [, is another name for test. IIRC the equal sign is not valid in that context. Can you post the 'before' and 'after' versions of that part of your script? It would help us in determining what the problem is. -- Chris Hill ch...@monochrome.org ** [ Busy Expunging <|> ] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"