Bin/sh 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 the workings and policies bin sh 1 syntax error unexpected of this site About Us Learn more about Stack Overflow the company Business
Bash Syntax Error Redirection Unexpected
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges cron redirection unexpected Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:
Debconf-set-selections Redirection Unexpected
Sign up Syntax error: redirection unexpected up vote 3 down vote favorite 2 I ran a deployment script to setup my server as root. Then I tried to run another script called test.sh which had the following lines in it: # Logging exec > >(tee -a /var/log/test_full.log) exec 2> >(tee -a /var/log/test_error.log) However when I try this I get the following error: test.sh: bash redirection 19: test.sh: Syntax error: redirection unexpected What might be causing this issue do you think? I've not heard of this error before. linux bash shell debian share|improve this question asked Nov 24 '13 at 19:00 Jimmy 3,15594487 add a comment| 2 Answers 2 active oldest votes up vote 6 down vote accepted This answer solves your problem, assuming that your script snippet is complete. In brief, you are running your script through dash, not bash. The solution is as simple as adding the necessary #!/bin/bash What a system runs by default if the #! is missing varies from system to system. On my system, I don't get your error because a shell that understands your redirections is run by default. I've had to simulate the case where dash would be the default shell to reproduce your error. share|improve this answer answered Nov 24 '13 at 20:04 Louis 52.8k1194123 Hi. Sorry to be a pain but both files start with #!/bin/bash –Jimmy Nov 24 '13 at 20:57 Fact: when I run your test.sh script as bash test.sh there's no error, but when
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings
Syntax Error: "(" Unexpected
and policies of this site About Us Learn more about Stack Overflow
Bash Split String
the company Business Learn more about hiring developers or posting ads with us Stack Overflow 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 each other. Join them; it only http://stackoverflow.com/questions/20179531/syntax-error-redirection-unexpected takes a minute: Sign up shell script syntax error: redirection unexpected during done command up vote 0 down vote favorite So, I'm trying to make a shell script for a class and it basically just performs a few administrative operations. Right now, I'm getting a syntax error on the done command on lines 27 and 45. I feel it might http://stackoverflow.com/questions/18777815/shell-script-syntax-error-redirection-unexpected-during-done-command be my use of awk. #!/bin/sh ps -cefl > userInfo while [ "$menuOption" != 4 ]; do echo "====================================" echo "Select a menu option!" echo "(1) Ancestry History" echo "(2) Who's online" echo "(3) What process a user is running" echo "(4) Exit" echo -n "Menu option:" read menuOption echo " " if [ "$menuOption" -eq 1 ]; then echo "The ancestry tree for the current process is. . ." echo " " PID=$$ while [ $PID -ne 1 ] do echo $PID echo " | " while read PIDS; do myPID=$(echo $PIDS | awk '{print $1}') myPPID=$(echo $PIDS | awk '{print $2}') if [ $myPID -eq $PID ]; then PID=$myPPID fi done < <(grep $PID userInfo | awk '{printf "%i %i\n",$4,$5}') done echo " 1 " echo " " elif [ "$menuOption" -eq 2 ]; then echo "Online users:" echo "-------------" who | awk '{print $1}' | sort -u echo "-------" echo " " elif [ "$menuOption" -eq 3 ]; then i=0 echo "Select a user to see the processes!" echo "-----------------------------------" while read value; do listNames["$i"]="$value" echo "$i)${lis
Search HCL Search Reviews Search ISOs Go to Page... LinuxQuestions.org > Forums > Linux Forums > Linux - General bash script: Syntax error: redirection unexpected User Name Remember Me? Password Linux - General This Linux forum is for http://www.linuxquestions.org/questions/linux-general-1/bash-script-syntax-error-redirection-unexpected-927865/ general Linux questions and discussion. If it is Linux Related and doesn't seem to fit in any other forum then this is the place. Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and syntax error absolutely free. Join our community today! Note that registered members see fewer ads, and ContentLink is completely disabled once you log in. Are you new to LinuxQuestions.org? Visit the following links: Site Howto | Site FAQ | Sitemap | Register Now If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here. Having a problem logging in? Please visit this page to syntax error redirection clear all LQ-related cookies. Introduction to Linux - A Hands on Guide This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own. Click Here to receive this Complete Guide absolutely free. Search this Thread 02-06-2012, 04:50 AM #1 make Member Registered: Apr 2004 Distribution: Mandriva, Ubuntu, openSuSE, FreeBSD, OpenSolaris, PC-BSD Posts: 190 Rep: bash script: Syntax error: redirection unexpected This is probably an easy thing for you shell gurus but I'm banging my head to the wall with it. I updated Debian Lenny (5) to Squeeze (6). Now my script suddenly stopped working. Something has changed with bash. Code: #!/bin/bash url='' while grep -qv 'STOP$' <<<"$url" do read -n1 next url="$url$next" done This part of the script is the problem. It is supposed t