LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Shell script execution on two different Linux OS (http://www.linuxquestions.org/questions/programming-9/shell-script-execution-on-two-different-linux-os-4175423483/)

yamanoorsai 08-22-2012 03:14 PM

Shell script execution on two different Linux OS
 
I have the following sample piece of script that works properly on Ubuntu but it stops working when I switch to slackware:

Code:

dialog --title "Test" --gauge "Copying file." 6 100 < <(
    rsync -a --progress test.tar.gz /media/sda1 |
    unbuffer -p grep -o "[0-9]*%" |
    unbuffer -p cut -f1 -d '%' 
    )

The error is:

Code:

Syntax error near unexpected token `<'
If I get rid of dialog command, I am able to execute the script. What could be wrong?

cortman 08-22-2012 03:17 PM

Quote:

Originally Posted by yamanoorsai (Post 4761447)
I have the following sample piece of script that works properly on Ubuntu but it stops working when I switch to slackware:

Code:

dialog --title "Test" --gauge "Copying file." 6 100 < <(
    rsync -a --progress test.tar.gz /media/sda1 |
    unbuffer -p grep -o "[0-9]*%" |
    unbuffer -p cut -f1 -d '%' 
    )

The error is:

Code:

Syntax error near unexpected token `<'
If I get rid of dialog command, I am able to execute the script. What could be wrong?

It makes a difference what shell you are using; Ubuntu uses Dash, Slack uses Bash AFAIK. I don't believe Dialog comes with Bash.

NevemTeve 08-22-2012 03:18 PM

Code:

dialog ... < <(...
what this syntax means?

yamanoorsai 08-22-2012 03:20 PM

I installed dialog myself. The dialog tool works perfectly in all other cases. In fact, I am using a similar syntax in a while loop. I had no problems in that context. It keeps failing here

yamanoorsai 08-22-2012 03:27 PM

Quote:

what this syntax means?
I adopted the syntax from here:

Code:

http://bash.cyberciti.biz/guide/A_progress_bar_(gauge_box)
It basically redirects stdout to dialog command to provide percentage input to the command

yamanoorsai 08-22-2012 08:17 PM

I found the problem. There was a bash version mismatch. I wrote the script on a newer version of bash. Yet to fix the problem due to the version mismatch


All times are GMT -5. The time now is 03:27 AM.