Re: [SLUG] Bash Help Needed

From: James Forte (james@magna.net)
Date: Sat May 17 2008 - 13:37:08 EDT


quote the $1 as in "$1"

---------------------------------------------------------------
James Forte, Magna Timeshare Software
http://www.magna.net/ mailto:James@Magna.Net
-----------------------------------------------------------------

On Sat, 17 May 2008, Ron Youvan wrote:

>> printf "argument= %s\n" "$1" #works
>> correctly
>
>> if [$1 -eq ""]; then
>> cnt=10
>> printf "$1 is blank\n" "$cnt" else
>> printf "$1 is not blank\n" "$cnt"
>> cnt=$1
>> fi
>
>> printf "cnt=%s\n" $cnt
>
>> Error: If there is no argument I get this message: line
>> 9: -eq: command not found
>> If there is an argument of 15: line 9: 15: command not
>> found
>
>> Anyone have any idea what I am doing wrong? line 9 is
>> the 'if' statement
>
>
> #!/bin/bash
> # /usr/local/bin/bed
> # by Ron KA4INM Youvan
> if
>
> Here my "if" is on line #4, is that right?
> if there is no command -eq you may need to put -e -q
>
> My "bash" book is for version 2.0 so it is out of date.
>
>
> --
> Ron KA4INM - The harder I work, the behinder I get!
> -----------------------------------------------------------------------
> This list is provided as an unmoderated internet service
> by Networked
> Knowledge Systems (NKS). Views and opinions expressed in
> messages
> posted are those of the author and do not necessarily
> reflect the
> official policy or position of NKS or any of its
> employees.
>
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:51:09 EDT