I'm following this tutorial http://ubuntuforums.org/showthread.php?t=1550470 to install a GUI for Phorinix test suite installing it on Ubuntu 12.04. I already have the test suite and PHP5 installed, both running fine in the terminal but I'm now trying to create the GUI.
When running this part of the tutorial:
cd /usr/share/aclocal
sudo cp libtool.m4 libtool.m4~backup
sudo chmod 777 libtool.m4
(start line) sudo cat lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 >>libtool.m4 (end line)
sudo chmod 644 libtool.m4
I get the following error:
bash: syntax error near unexpected token `sudo'
Any ideas?
The (start line) and (end line) markers look more like comments than they do commands that fit the rest of the script. But if they really belong, they need to be separated from the rest of the line with
(start line); sudo cat ... >> libtool.m4; (end line)
Remove the (start line) and (end line). The original poster added these when the forum would cut off lines in order to fit code blocks in a certain width.
Related
I have an exe file which executing some commands in docker container (ubuntu) that should make a build and run application. In some step I need to make a copy of dist file and command looks like this
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v //f/bigaboo/repos/ledger://f/bigaboo/repos/ledger --workdir=//f/bigaboo/repos/ledger bbcli_executor bash -c "cp ./public/index.php.dist ./public/index.php"
When I just run this command in the terminal all works well but if it's under exe control I have this output
./public/index.php.dist: -c: line 1: unexpected EOF while looking for matching `"'
./public/index.php.dist: -c: line 2: syntax error: unexpected end of file
2022/10/31 22:14:42 Failed to create index.php`. Error -> exit status 2
Looks like script don't recognize strings under exe.
I've tried to wrap cp in '',`` and \x22 but I've got the same result but with different symbols also I've tried to change encoding also without success :(
I'm trying to run a small bash script inside my CodeBuild process as per the AWS documentation and this.
deploy.sh can be found in the src/ directory:
#!/bin/bash
pwd=$PWD
for dir in */ ; do
target="$pwd/${dir%/}"
cd "$target"
npm install
sls deploy && sls s3deploy
done
buildspec file:
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
commands:
- cd backend/functions/src
- npm install serverless
build:
commands:
- ls
- ./deploy.sh
after the ls command above in the logs, I can see that deploy.sh is there in the current directory.
Error:
/codebuild/output/tmp/script.sh: 4: /codebuild/output/tmp/script.sh: ./deploy.sh: not found
I've also tried using the command /bin/bash deploy.sh but this results in another error:
deploy.sh: line 2: $'\r': command not found
deploy.sh: line 4: $'\r': command not found
deploy.sh: line 7: $'\r': command not found
deploy.sh: line 8: syntax error near unexpected token `$'do\r''
deploy.sh: line 8: `for dir in */ ; do
(First written as a comment, it solved the problem)
The files were made in Windows.
Change CRLF to LF and the \r is gone.
The first answer by Walter A worked for me, this is what i did .
Opened the file in VS Code
At bottom left corner for Select End Of Line Sequence it showed CRLF
clicked on CRLF and selected LF
Uploaded the file to github and it started working.
I'm trying to install Netdata in my aws beanstalk instances. I created a config file in my .ebextensions folder
container_commands:
00install:
command: "bash <(curl -Ss https://my-netdata.io/kickstart.sh) --dont-wait"
ignoreErrors: true
When the command gets ran on deploy beanstalk logs this error.
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `bash <(curl -Ss https://my-netdata.io/kickstart.sh) --dont-wait'
I had no idea what <() meant so I looked it up and saw it was process substitution. From what I understood process substitution can be rewriting using plain pipes.
For example
more <( ls /usr/bin )
Could be
ls /usr/bin | more
In my command I'm also passing in flags so I was having issues gettin the piped version of the command working.
NOTE: The root problem is beanstalk telling me its confused about the parenthesis. My solution was just transforming the command to use regular pipes. However, if anyone knows just how I write this command on the beanstalk config to get it working that would be awesome.
The following line fails when run in a alpine docker container:
toDelete=( $(curl --silent $url/_cat/indices\?format=json | jq -r '.[].index | select(startswith('\".kibana\"'))') )
The following error message appears:
run.sh: line 1: syntax error: unexpected "("
When I run the command in the terminal on my mac, everything works properly. The brackets are added so that the result (variable toDelete) is interpreted as array and can be looped through with a for loop like so:
for index in "${toDelete[#]}"; do
curl -X DELETE $url/$index
done
Any help in how to solve this problem is appreciated!
Marking down the answer.
The issue was with the interpreter.
worked after making the below change.
["/bin/ash", "run.sh"]
the passed one was
["/bin/sh", "run.sh"]
For the last couple of hours I have been trying to start my startup.sh script on docker container start, but for some reason it doesn't work.
My Dockerfile to create the image:
FROM armv7/armhf-ubuntu:latest
MAINTAINER Mohammed Noureldin <m.n.e#hotmail.com>
RUN apt update && apt upgrade -y && apt install -y mumble-server
ADD scripts/startup.sh /startup.sh
My startup script:
#!/bin/bash
/etc/init.d/mumble-server start
Nothing happens here, though I tried to create a file inside the script but also nothing happened!
I tried to execute the script directly from command line, but it doesn't work I don't know why:
docker run command:
docker run --name murmur -itd --restart always --network bridge -p 64738:64738 -v /var/lib/mumble-server/ -v /etc/ mnoureldin/murmur:latest /bin/bash -c "bash /startup.sh;/bin/bash"
And here what I get when trying to execute the script manually:
43b9d8dd4116bc605537c7af35ab186ca165ea6e957fab5908d39b2f085edf41
mohammed#server01:~/Dockerfiles/Mumble $ docker attach murmur
root#43b9d8dd4116:/# bash
.dockerenv boot/ etc/ lib/ mnt/ proc/ run/ srv/ sys/ usr/
bin/ dev/ home/ media/ opt/ root/ sbin/ startup.sh tmp/ var/
root#43b9d8dd4116:/# bash startup.sh
Usage: /etc/init.d/mumble-server {start|stop|restart|force-reload}
Or when I have an empty line between the two lines of the script I get this error:
root#830193e67fd7:/# bash startup.sh
startup.sh: line 2: $'\r': command not found
Usage: /etc/init.d/mumble-server {start|stop|restart|force-reload}
Could some one explain what is heppening and why it doesn't work?
The error is caused by the line endings in your shell script. It looks like you're using Windows line endings (CRLF, or \r\n), where the unexpected r is confusing Bash. Bash only expects LF or \n, hence the error message.
Most programmer text editors have some kind of support for making these changes. Notepad++ has "Edit > EOL Conversion > Unix/OSX Format". Please see EOL conversion in notepad ++ for more info.