LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-22-2012, 03:14 PM   #1
yamanoorsai
LQ Newbie
 
Registered: Jul 2012
Posts: 10

Rep: Reputation: Disabled
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?
 
Old 08-22-2012, 03:17 PM   #2
cortman
Member
 
Registered: Jan 2012
Location: ZZ9 Plural Z Alpha
Distribution: Crunchbang 11, LFS 7.3, DSL 4.1.10, Lubuntu 12.10, Debian 7
Posts: 219

Rep: Reputation: 43
Quote:
Originally Posted by yamanoorsai View Post
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.
 
Old 08-22-2012, 03:18 PM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,869
Blog Entries: 1

Rep: Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870
Code:
dialog ... < <(...
what this syntax means?
 
Old 08-22-2012, 03:20 PM   #4
yamanoorsai
LQ Newbie
 
Registered: Jul 2012
Posts: 10

Original Poster
Rep: Reputation: Disabled
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
 
Old 08-22-2012, 03:27 PM   #5
yamanoorsai
LQ Newbie
 
Registered: Jul 2012
Posts: 10

Original Poster
Rep: Reputation: Disabled
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
 
Old 08-22-2012, 08:17 PM   #6
yamanoorsai
LQ Newbie
 
Registered: Jul 2012
Posts: 10

Original Poster
Rep: Reputation: Disabled
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
 
  


Reply

Tags
dialog, rsync, shell



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
a shall script for remote shell execution ramesh14 Linux - Newbie 3 03-27-2011 07:59 AM
Java hangs even though shell script’s execution is completed pavanlimo Programming 5 08-16-2010 03:49 PM
shell script execution on double click havejeet Linux - Newbie 6 06-05-2010 03:08 AM
How to control execution of programs in a shell script. Chrisantha1 Programming 5 04-28-2010 03:29 AM
Speeding up Shell Script execution?? funkymunky Programming 8 07-16-2004 08:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration