On Sat, Aug 16, 2014 at 02:44:14PM -0700, Mike Wright wrote:
> Hi all,
> 
> I'm trying to write a simple script that if provided an argument, uses that,
> or if nothing is provided, uses a predefined string.
> 
> if [ -n $# ]
This will always be true.  -n tests if a string is empty or not.  0
counts as non-empty.  You should use one of the comparison operators.
Try something like this:

  [ $# -gt 0 ]

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Reply via email to