Use "=" as alister suggests. Unfortunately I didn't understand what you did in here: Code: if diff -q /home/alex/Desktop/lol /home/alex/Desktop/lol1 >/dev/null 2>&1 echo "match" else echo "mismatch" fi Remove advertisements Sponsored Links hakermania Meaning of "soul-sapping" Do COB LEDs usually need electrically insulating from the heatsink? Though in theory you save yourself a fork. –Otheus Nov 6 '15 at 19:09 1 bash [[ ... ]] does not perform word splitting or glob expansion (ref), so the
Join them; it only 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 spectral norm of block-wise sums of matrices Can I use an HSA as investment vehicle by overcontributing temporarily? How to make different social classes look quite different?
You can have the script run with bash automatically by changing the first line to #!/bin/bash and making the file executable, and just running ./choose.sh. –Tyler McHenry Aug 5 '10 at Bash Unexpected Operator String Comparison Natural construction Please explain the local library system in London, England So sayeth the Shepherd How to deal with a really persuasive character? Why? Linux is a registered trademark of Linus Torvalds.
In a GNU C macro envSet(name), what does (void) "" name mean? Bash Script Error Check Missing quotes Edit line 6 to remove the trailing quote from the end of the line: echo "Number equals 1 and run the script again. Sometimes some hidden characters are there in the source. Can a creature benefit from differently typed speed bonuses all named fast movement?
current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community. Bash Script Syntax Error Unexpected End Of File If not, why? Unexpected Operator In Shell Script bash shell ubuntu shell-script share|improve this question edited Aug 18 '12 at 12:08 Gilles 369k666681119 asked Aug 18 '12 at 11:37 kemra102 4681613 The shebang is really in line
This time you should get the following: [[email protected] me]$ ./trouble.bash /trouble.bash: [: =: unary operator expected. his comment is here When i executed the same code in Linux and in cygwin i was not getting any errors –Raghuram Aug 5 '10 at 1:11 1 Cygwin has most likely aliased sh The time now is 08:37 PM. - Contact Us - Unix & Linux - unix commands, linux commands, linux server, linux ubuntu, shell script, linux distros. - Advertising - Top Adopt A Jet/Book When taking passengers, what should I do to prepare them? Unexpected Operator Shell Script If
asked 3 years ago viewed 680 times active 3 years ago Related 3Why does this “while read” work in a terminal, but not in a shell script?1Why do I get different Intuition behind Harmonic Analysis in Analytic Number Theory A simple visual puzzle to die for Does mean=mode imply a symmetric distribution? sh supports [. == works in Bash built-ins [[, test and [ while a single = is required by POSIX version of [ and test. (Bash manual says the same, BTW.) http://gatoisland.com/bash-script/bash-script-set-error.php Is the following extension of finite state automata studied?
Even filenames with newlines are handled correctly. Bash Script Error Output Verbs of buttons on websites Adopt A Jet/Book My girlfriend has mentioned disowning her 14 y/o transgender daughter On THE other hand or on another hand? Skeletal formula for carbon with two double bonds Is there a way to make a metal sword resistant to lava?
Password Linux - Newbie This Linux forum is for members that are new to Linux. There is nothing about this line running as sudo that should stop it working to my knowledge, does anyone have any ideas? Meaning of Guns and ghee Can filling up a 75 gallon water heater tank without opening a faucet cause damage? Bash Script Error Log How to book a flight if my passport doesn't state my gender?
up vote 3 down vote favorite Why does the following script display an "unexpected operator" message and fail when run with SH, but not with BASH. !/bin/sh if [ $UID -ne Forum Operations by The UNIX and Linux Forums current community chat Unix & Linux Unix & Linux Meta your communities Sign up or log in to customize your list. Resulting variable is not the same value as file, why?0Why does downloading bash script from pastebin not work?25If “bash
Video displays in Star Wars Can Customs make me go back to return my electronic equipment or is it a scam? As for your method of cat'ing the files into variables might not be the most efficient way to accomplish your task. Can Customs make me go back to return my electronic equipment or is it a scam? rtmistler View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by rtmistler View Blog 03-08-2014, 02:46 AM #4 s.verma Member Registered: Oct 2013
For instance if one the files has a '-' (dash/hyphen) in the filename which is not escaped (by prefixing it with a backslash ('\')) it might be interpreted as a parameter.