Gcc Syntax Error Redirection Unexpected
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss cron redirection unexpected the workings and policies of this site About Us Learn more !#/bin/bash: not found about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow line 1: syntax error: unexpected word (expecting ")") Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping
Syntax Error Word Unexpected (expecting ) ) Shell Script
each other. Join them; it only takes a minute: Sign up Bash: Syntax error: redirection unexpected up vote 53 down vote favorite 11 I do this in a script: read direc <<< $(basename `pwd`) and I get: Syntax error: redirection unexpected in an ubuntu machine /bin/bash --version GNU bash, version 4.0.33(1)-release (x86_64-pc-linux-gnu) while I do not get this bash syntax error near unexpected token error in another suse machine: /bin/bash --version GNU bash, version 3.2.39(1)-release (x86_64-suse-linux-gnu) Copyright (C) 2007 Free Software Foundation, Inc. Why the error? bash share|improve this question edited Mar 6 at 17:20 Willi Mentzel 2,33891840 asked Mar 17 '10 at 12:58 flow 4,2883295157 For reference, the command works on cygwin as well ( /bin/bash --version GNU bash, version 3.2.49(23)-release (i686-pc-cygwin) Copyright (C) 2007 Free Software Foundation, Inc. ) –hlovdal Mar 17 '10 at 13:08 add a comment| 3 Answers 3 active oldest votes up vote 93 down vote accepted Does your script reference /bin/bash or /bin/sh in its hash bang line? The default system shell in Ubuntu is dash, not bash, so if you have #!/bin/sh then your script will be using a different shell than you expect. Dash does not have the <<< redirection operator. share|improve this answer answered Mar 17 '10 at 13:05 John Kugelman 174k36306384 Is there a way to fix this easily ? –Sliq Dec 21 '14 at 20:52 3 @Sliq, yes use !#/
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings bash redirection and policies of this site About Us Learn more about Stack Overflow
Debconf-set-selections
the company Business Learn more about hiring developers or posting ads with us Unix & Linux Questions Tags
Cannot Execute Binary File: Exec Format Error
Users Badges Unanswered Ask Question _ Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only http://stackoverflow.com/questions/2462317/bash-syntax-error-redirection-unexpected takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Shell script fails: Syntax error: “(” unexpected up vote 31 down vote favorite 7 I've been working on a script that automates setting up a development environment for Raspberry Pi development (step by step http://unix.stackexchange.com/questions/45781/shell-script-fails-syntax-error-unexpected details that work are here). The script is linked in that article but convenience you can find it here also. Now when run this script install and sets up the environment without error but you have to enter your sudo password more than once due to sudo's time-out value by default. So I started experimenting by removing all the sudo lines and running the whole script via sudo at the command line like so: kemra102@ubuntuvm:~$ sudo ./pi_dev_env_install.sh This works fine as expected and gets most of the way through until this point: ./pi_dev_env_install: 68: ./pi_dev_env_install.sh: Syntax error: "(" unexpected Now this line worked fine previously when not running the whole script with sudo. There is nothing about this line running as sudo that should stop it working to my knowledge, does anyone have any ideas? bash shell ubuntu shell-script share|improve this question edited Aug 18 '12 at 12:08 Gilles 372k696751126 asked Aug 18 '12 at 11:37 kemra102 4731613 The shebang is really in line 9? Due to Ubuntu's DashAsBinSh affinity I suspect your script is interpreted by dash instead of b
Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here. Search Forums Show Threads Show Posts Tag Search Advanced Search Unanswered Threads Find All Thanked http://www.unix.com/shell-programming-and-scripting/104598-syntax-error-unterminated-quoted-string.html Posts Go to Page... unix and linux operating commands Syntax error: Unterminated quoted string Shell Programming and Scripting Thread Tools Search this Thread Display Modes #1 03-13-2009 evilSerph Registered User Join Date: Mar 2009 Last Activity: 16 March 2009, 11:36 AM EDT Posts: 4 Thanks: 0 Thanked 0 Times in 0 Posts Syntax error: Unterminated quoted string I keep having problems when exicuting syntax error this file. It always gives me the error message "36: Syntax error: Unterminated quoted string" If someone could help me edit this it would be much appreciated. Code: #!/bin/sh # # This will continue adding numbers # untill the total is greater than 1,000 # if test $num1=0 then { echo "Please enter two numbers." read num1 Total echo "The number you entered is $num1" Total = `expr $Total + $num1` } elif test gcc syntax error $num1>0 then { echo "The current value is $Total." echo "Please enter another number." read num1 echo "The number you entered is $num1" Total = `expr $Total + $num1` } elif test $num1<0 then { echo "I'm sorry, the value you entered is invalid" echo "Please enter a number that is greater than zero." read num1 echo "The number you entered is $num1" Total = `expr $Total + $num1`" } else { echo "Total is greater than 1,000\n" echo "CAN NOT COMPUTE!!!!!\n" echo "System shutdown" } fi Last edited by DukeNuke2; 03-13-2009 at 02:00 PM.. Remove advertisements Sponsored Links evilSerph View Public Profile Find all posts by evilSerph #2 03-13-2009 DukeNuke2 Soulman Join Date: Jul 2006 Last Activity: 16 October 2016, 3:39 PM EDT Location: Berlin, Germany Posts: 5,625 Thanks: 66 Thanked 279 Times in 269 Posts Quote: Originally Posted by evilSerph Code: #!/bin/sh elif test $num1<0 then { echo "I'm sorry, the value you entered is invalid" echo "Please enter a number that is greater than zero." read num1 echo "The number you entered is $num1" Total = `expr $Total + $num1`" } fi delete the red " Remove advertisements Sponsored Links DukeNuke2 View Public Profile Visit DukeNuke2's homepage! Find all posts by DukeNuke2 #3 03-13-200