Using running cygwin64 terminal, on Windows Server 2012 R2,
I am getting the following error:
$ set username=<username>
$ icacls D:\FTPRoot\%username% /inheritance:r /grant HAMFTP02\%username%:(CI)F /t
-bash: syntax error near unexpected token `('
It looks like you are entering Windows CMD commands at a bash prompt.
You will need to translate from CMD syntax to bash syntax.
Instead of set x=y you need to use x=y.
Instead of %x% you need to use $x or ${x}.
You will also need to escape bash special characters.
At the bash prompt, you can enter info bash to display some terse documentation.
A google search https://www.google.com/search?q=bash+tutorial will point you to several gentler introductions to bash.
HTH
Related
When i try to run bash xfce4.sh, it gives me the error:
xfce4.sh: line 1: syntax error near unexpected token <'
xfce4.sh: line 1: <html><head><title>Loading...</title></head><body><script type='text/javascript'>window.location.replace('https://kali.sh/xfce4.sh?ch=1&js=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJKb2tlbiIsImV4cCI6MTY2NjkxMzIzMCwiaWF0IjoxNjY2OTA2MDMwLCJpc3MiOiJKb2tlbiIsImpzIjoxLCJqdGkiOiIyc2gwa2QwZW4xdWdicTlvaGMwdDRwb2EiLCJuYmYiOjE2NjY5MDYwMzAsInRzIjoxNjY2OTA2MDMwNzgyMDIxfQ.tN_1ZFHTKGGPtECn_V_PNJhsE8II0fcxWjYnZhB9evc&sid=1de40110-563e-11ed-ba81-f9449723c437');</script></body></html>'
I have tried to install dos2unix and converted xfce4.sh to Unix format, but still gave the same problem.
You're trying to run an HTML file as a bash script.
After you download the correct file, you also need to make it executable:
chmod +x xfce4.sh
Then execute it; you can also execute a script with:
./xfce4.sh
Assuming your current directory is the same as the script's directory.
Error I get is following:
After the new window is open, please hit enter to go on../config: line 82: syntax error near unexpected token newline'
./config: line 82:set reply=$<'
I'm in bash shell. The script was originally meant for csh. I've changed the first line of the script to #!/bin/bash.
The script is supposed to open a new window to enter some variables for configuring.
.
.
.
echo "use the word 'type' to indicate it is a command for the other window."
echo " "
echo -n "After the new window is open, please hit enter to go on."
set reply=$<
tput clear
I've checked and know that the shell is interactive. Instead of executing with sh ./config I tried with bash ./config ; still same error. if I type < in the shell I get the same error. So I figured that make cannot understand '<'
I'm at my wits end googling for the error. Any help is appreciated!
Thanks to meatspace! I abandoned the idea of 'fixing' but just get it running.
What worked was running the script while I'm in tcsh - no edits needed in the script. Since I only needed to set everything for the configuration file it didn't matter how the config script generated the actual installation script.
After that is generated I just switched to bash and everything worked.
The following command works fine on the command line, but not in a bash script.
cat dir/!(00|01)/* > all.txt
When executing the same command in a bash script I get the following error:
../scripts/preprocess.sh: line 8: syntax error near unexpected token `('
../scripts/preprocess.sh: line 8: ` cat dir/!(00|01)/* > all.txt'
Does anyone know how to get this to work in a script?
Thanks
You need to set the same shell option in the script that is set at the command line, namely extglob.
i have perl script that used to be working great , once i edit it in windows
and convert it to UTF-8 and then via FTP return it .
also did:
chmod +x foo.pl
and then when i try to run it :
./foo.pl
im getting this error:
./foo.pl: Exec format error. Wrong Architecture.
what ? what wrong Architecture ? whats going on here ?
This is most likely due to the Windows-style line endings. To solve, on the unix prompt: vi foo.pl and then :set ff=unix followed by :wq to save and quit.
I am trying to Run Shell script in Cygwin but I am getting Following error msgs:
app.sh: line 215: clear: command not found
[: scripts/Test: binary operator expected.
The folder scripts/Test ID Not found...
Can Any one suggest. What is the problem Do i need to re install Cygwin again.
Because Same Script Running fine in the Linux Envirnment.
Thanks in Advance.....
the script is probably using '#!/bin/sh' but expects the behaviour of /bin/bash. Try executing the script as: /bin/bash shell_script.sh
debugging tools include executing the script with the -x option, i.e. bash -x shell_script.sh. The problem from the outset looks like an unset variable that is being checked using the unprotected form:
if [ $x = ]
the problem is that if $x is unset, then you end up with an empty token, which causes the script to fail.
for the explicit 'clear' command not found, the cygwin implementation of that is to call 'tput clear' if you replace the 'clear' call with 'tput clear' then it should work.