Bash Command Substitution Syntax Error Near Unexpected Token
Contents |
here for a quick overview of the site Help Center Detailed answers to any
Bash Syntax Error Near Unexpected Token Done'
questions you might have Meta Discuss the workings and policies bash syntax error near unexpected token echo' of this site About Us Learn more about Stack Overflow the company Business Learn more bash syntax error near unexpected token (' ubuntu 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
Bash Syntax Error Near Unexpected Token Else'
Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up PS1 bash command substitution not working on windows 10 up vote 2 down vote favorite This is my script that sets up my bash PS1 # Reset Color_Off="\[\033[0m\]" #
Bash Syntax Error Near Unexpected Token Fi'
Text Reset # Regular Colors Black="\[\033[0;30m\]" # Black Red="\[\033[0;31m\]" # Red Green="\[\033[0;32m\]" # Green Yellow="\[\033[0;33m\]" # Yellow Blue="\[\033[0;34m\]" # Blue Purple="\[\033[0;35m\]" # Purple Cyan="\[\033[0;36m\]" # Cyan White="\[\033[0;37m\]" # White # Bold BBlack="\[\033[1;30m\]" # Black BRed="\[\033[1;31m\]" # Red BGreen="\[\033[1;32m\]" # Green BYellow="\[\033[1;33m\]" # Yellow BBlue="\[\033[1;34m\]" # Blue BPurple="\[\033[1;35m\]" # Purple BCyan="\[\033[1;36m\]" # Cyan BWhite="\[\033[1;37m\]" # White # Various variables you might want for your PS1 prompt instead Time12h="\T" Time12a="\@" PathShort="\w" PathFull="\W" NewLine="\n" Jobs="\j" GIT_PS1_SHOWDIRTYSTATE="true" PS1="\n${BBlack}\u@\h ${BRed}\w${BYellow}\$(__git_ps1 ' { %s }')${BGreen}\n$ " It was working perfectly until yesterday I decided to update my laptop to windows 10. Now it throws this error: bash: command substitution: line 1: syntax error near unexpected token `)' bash: command substitution: line 1: `__git_ps1 ' { %s }')' Any idea on what is causing this error? bash windows-10 ps1 share|improve this question asked Oct 19 '15 at 17:32 StefanoGermani 449211 add a comment| 1 Answer 1 active oldest votes up
HCL Search Reviews Search ISOs Go to Page... LinuxQuestions.org > Forums > Linux Forums > Linux - General bash syntax error near unexpected token then' [SOLVED] Repeatedly getting command substitution: line 3: syntax error near unexpected
Bash Syntax Error Near Unexpected Token Do'
token User Name Remember Me? Password Linux - General This Linux forum is for general Linux questions bash syntax error near unexpected token newline' 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 http://stackoverflow.com/questions/33220492/ps1-bash-command-substitution-not-working-on-windows-10 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 absolutely free. Join our community today! Note that registered members see fewer http://www.linuxquestions.org/questions/linux-general-1/repeatedly-getting-command-substitution-line-3-syntax-error-near-unexpected-token-829479/ 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 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 und
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of http://unix.stackexchange.com/questions/151911/syntax-error-near-unexpected-token this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Unix & Linux Questions Tags Users Badges Unanswered Ask Question https://sourceforge.net/p/msys2/tickets/17/ _ 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 takes a minute: Sign up Here's syntax error how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Syntax error near unexpected token `(' up vote 10 down vote favorite 2 When I use below code in SSH terminal for CentOS it works fine: paste <(printf "%s\n" "TOP") But if I place the same line code in a shell script (test.sh) syntax error near and run shell script from terminal, it throws error as this ./test.sh: line 30: syntax error near unexpected token (' ./test.sh: line 30: paste <(printf "%s\n" "TOP") How can I fix this problem? shell share|improve this question edited Aug 24 '14 at 14:30 Braiam 16.8k95599 asked Aug 24 '14 at 14:24 NecNecco 1761110 How exactly are you running it? what '#!' line (if any) starts your script? It looks like you are invoking a shell interpreter that doesn't support that syntax (e.g. dash instead of bash). –steeldriver Aug 24 '14 at 14:28 I have #!/bin/sh at the top. I executed as bash test.sh but it did not work either. –NecNecco Aug 24 '14 at 14:49 bash in POSIX mode doesn't support that syntax either (when called with --posix or as /bin/sh). Use #!/bin/bash. –jordanm Aug 24 '14 at 15:21 @NecNecco: Do you have POSIXLY_CORRECT variable set when you start bash? –cuonglm Aug 24 '14 at 15:31 @jordanm switching to #!/bin/bash at the top fixed the problem. –NecNecco Aug 24 '14 at 16:51 | show 4 more comments 2 Answers 2 active oldest vote
A Cygwin-derived software distro for Windows using Arch Linux's Pacman Brought to you by: lexx83, mingwandroid Summary Files Reviews Support Wiki Tickets Discussion Mailing Lists External Link ▾ Tracker MINGW Tracker MSYS2 Create Ticket View Stats Milestone 1.0 2.0 Searches Changes Closed Tickets Open Tickets Help Formatting Help #17 PS1 command substitution Milestone: 1.0 Status: open Owner: nobody Labels: None Updated: 2014-12-03 Created: 2014-02-02 Creator: Steven Penny Private: No http://stackoverflow.com/q/21517281 This command succeeds $ PS1='$(date +%s) $ ' 1391380852 $ However if I add a newline it fails $ PS1='$(date +%s)\n$ ' bash: command substitution: line 1: syntax error near unexpected token `)' bash: command substitution: line 1: `date +%s)' If I use backticks it works $ PS1='`date +%s`\n$ ' 1391381008 $ but backticks are discouraged. So what is causing this error? Discussion Kjartan Fredrik Kvamme - 2014-08-22 I'm running into the same thing when trying to use the git-prompt in MSYS2. $ PS1='\w $(__git_ps1)\n $ ' bash: command substitution: line 1: syntax error near unexpected token `)' bash: command substitution: line 1: `__git_ps1)' /d/Source/testing $ The exact same prompt is working fine on another machine running Arch Linux, which also happens to be using the same version of bash (4.3.22). $ PS1='\w $(__git_ps1)\n $ ' ~/source/chandler (code-cleanup) $ If I remove the newline after the command substitution, it works. $ PS1='\w $(__git_ps1) $ ' /d/Source/testing (develop) $ It seems like $() style command substitution for some reason always fails in MSYS2 if a newline is present after it. If you would like to refer to this comment somewhere else in this project, copy and paste the following link: Matthieu Vachon - 2014-08-22 Here my own PS1 that works: # User P