Welcome!

Please read this important information about Spectre and Meltdown vulnerabilities.
Please read this important information about MX sources lists.
News
  • MX Linux on social media: here
  • Mepis support still here
Current releases
  • MX-17 Final release info here
  • MX-16.1 release info here
  • antiX-17 release info here
    New users
    • Please read this first, and don't forget to add system and hardware information to posts!
    • Read Forum Rules

[SOLVED]-Syntax error puzzling me

Here you can exchange scripts that you created or have permission to share with other users.
Message
Author
User avatar
greywolf
Forum Novice
Forum  Novice
Posts: 85
Age: 62
Joined: Sun Apr 20, 2008 9:06 pm

[SOLVED]-Syntax error puzzling me

#1 Postby greywolf » Mon Dec 11, 2017 11:18 pm

I am sure there is a very simple explanantion to this problem that is just eluding my weary mind at present? This line in a bash script is not parsing - I think I may have the right bracket in the wrong place? The error message is "couln't parse this test expression".

I would appreciate it if anyone could offer a solution to the syntax:

Code: Select all

if [ 0 -lt ${size} 2>> ${Trash} ] ; then


cheers,
greywolf.
Last edited by greywolf on Tue Dec 12, 2017 7:35 am, edited 1 time in total.
It is about the Dragons - it was always about the Dragons!

User avatar
Adrian
Forum Veteran
Forum Veteran
Posts: 7732
Age: 42
Joined: Wed Jul 12, 2006 1:42 am

Re: Syntax error puzzling me

#2 Postby Adrian » Tue Dec 12, 2017 12:59 am

I think you left a blank between the redirection and ${Trash} you should write 2>>${Trash}

However I don't see the point of redirecting the stderr, there's no stderr for a comparison as far as I know, you should probably just use:

Code: Select all

 if [ 0 -lt ${size} ] ; then

User avatar
greywolf
Forum Novice
Forum  Novice
Posts: 85
Age: 62
Joined: Sun Apr 20, 2008 9:06 pm

Re: Syntax error puzzling me

#3 Postby greywolf » Tue Dec 12, 2017 7:34 am

Adrian wrote:I think you left a blank between the redirection and ${Trash} you should write 2>>${Trash}

However I don't see the point of redirecting the stderr, there's no stderr for a comparison as far as I know, you should probably just use:

Code: Select all

 if [ 0 -lt ${size} ] ; then


Thanks, Adrian. You were spot on. I found my old bash scripting guide which confirms same.

cheers,
greywolf.
It is about the Dragons - it was always about the Dragons!


Return to “Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests