Cannot Execute Error In Shell Script
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 of this site About Us Learn more about Stack Overflow the company shell script cannot execute binary file Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs execute shell script mac Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just execute shell script putty like you, helping each other. Join them; it only takes a minute: Sign up shell script not executing up vote 2 down vote favorite 2 I am trying to run a shell script on unix, but I
Execute Bash Shell Script
am getting an error specifying it can't be executed. Command Unix> Abc.ksh ksh: Abc.ksh: cannot execute Also tried pcasvs17 > ./Abc.ksh ksh: ./Abc.ksh: cannot execute The script starts with #!/bin/ksh Any help is appreciated. shell ksh share|improve this question asked Apr 15 '13 at 0:45 misguided 1,18492958 add a comment| 1 Answer 1 active oldest votes up vote 7 down vote accepted chmod +x Abc.ksh and try again with ./Abc.ksh share|improve this answer answered execute unix shell script Apr 15 '13 at 0:46 ennuikiller 33.4k1185116 Thanks Mate , it worked. I'll accept the anwer.The access available before was -rw-r--r-- , after running the command the access available was -rwxr-xr-- –misguided Apr 15 '13 at 0:50 Can you explain why we need to do that? –user206168 Mar 18 '14 at 20:19 1 the x means "executable". Before the chmod command, the file could be Read and Written, but not eXecuted (not even by the person who wrote it) –andrew lorien Apr 15 '14 at 0:42 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged shell ksh or ask your own question. asked 3 years ago viewed 7776 times active 3 years ago Related 2108Check if a directory exists in a shell script779How to mkdir only if a dir does not already exist?364In a shell script: echo shell commands as they are executed179How to execute mongo commands through shell scripts?2Unable to execute shell script in Cygwin as a KornShell script0
& Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers Search Forums Show Threads Show execute linux shell script Posts Tag Search Advanced Search Unanswered Threads Find All Thanked Posts Go to Page...
Execute Sql Shell Script
linux operating commands and unix operating commands cannot execute message UNIX for Dummies Questions & Answers Page 1 of 2
Execute Java Shell Script
1 2 > Thread Tools Search this Thread Display Modes #1 01-29-2008 mncduffy Registered User Join Date: Jan 2008 Last Activity: 30 January 2008, 5:56 PM EST Posts: 5 Thanks: 0 Thanked 0 http://stackoverflow.com/questions/16006059/shell-script-not-executing Times in 0 Posts cannot execute message I am trying to install a piece of software using the provided install script, but when I run it, I get the following message: ./tem.sh[15]: /export/home/data/SoftwareSource/TcEng2005SR1/install/jre/bin/java: cannot execute I navigated to that directory and tried to execute java and it returns the same message: $ ./java ksh: ./java: cannot execute The install script is as follows: #!/bin/ksh SCRIPTDIR=`dirname $0` # The dir containing this script. SCRIPTDIR=`cd ${SCRIPTDIR}; http://www.unix.com/unix-for-dummies-questions-and-answers/51462-cannot-execute-message.html pwd` # Convert it to an absolute path - cd ${SCRIPTDIR} JARS=`ls -m install/*.jar|tr -s ',' ':'|tr -d ' \n'` ${SCRIPTDIR}/install/jre/bin/java -cp ${JARS} com.teamcenter.install.tem.struct.Tem $1 $2 $3 Any help is much appreciated, mncduffy Remove advertisements Sponsored Links mncduffy View Public Profile Find all posts by mncduffy #2 01-29-2008 joeyg modérateur Join Date: Dec 2007 Last Activity: 3 October 2016, 10:18 AM EDT Location: Within two miles of a Dunkin donuts. Posts: 2,409 Thanks: 100 Thanked 177 Times in 163 Posts trying to understand which command is in error? Is the problem with the ./tem.sh perhaps? Kind of hard to follow the cut/paste with potential line-wrap issues. Would a simple $chmod +x tem.sh solve this by making the shell script executable? Then you would $tem.sh to execute the script. Another thought to see where you are erroring is to edit the script (vi editor or other) and insert output comments such as: echo "SCRIPTDIR is now set" throughout the file. This will allow you to track the program progress. Remove advertisements Sponsored Links joeyg View Public Profile Visit joeyg's homepage! Find all posts by joeyg #3 01-29-2008 mncduffy Registered User Join Date: Jan 2008 Last Activity: 30 January 2008, 5:56 PM EST Posts: 5 Thanks: 0 Thanked 0 Times in 0 Posts Quote: Originally Post
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs https://www.experts-exchange.com/questions/24892135/ksh-cannot-execute.html Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > ksh cannot execute http://superuser.com/questions/435988/how-can-i-resolve-the-error-cannot-execute-binary-file Want to Advertise Here? Solved ksh cannot execute Posted on 2009-11-11 Unix OS Shell Scripting 4 Verified Solutions 7 Comments 4,425 Views Last Modified: 2013-12-27 Hey; I have a utility in Solaris, when i ran it, i got the following error: ksh: ./lh: cannot execute Thanks for your help 0 Question by:idmdeveloper Facebook Twitter LinkedIn Google LVL 68 Active 2 days ago Best Solution bywoolmilkporc ksh shell script ./lh or chmod +x ./lh and #!/bin/ksh as first line in script. wmp Go to Solution 7 Comments LVL 68 Overall: Level 68 Unix OS 53 Shell Scripting 30 Message Active 2 days ago Accepted Solution by:woolmilkporc2009-11-11 ksh ./lh or chmod +x ./lh and #!/bin/ksh as first line in script. wmp 0 LVL 22 Overall: Level 22 Unix OS 20 Shell Scripting 3 Message Assisted Solution by:blu2009-11-11 It sounds like the file is not really a script file. Cannot execute generally execute shell script means that the loader invoked is unable to figure out the format of the file being executed. You should run the "file" command on the file: file lh If it says anything about data or binary, then the file is just not a script file as required by ksh. IF it says something about a script or text, then you should look at the actual contents of the file. Do "head lh" and post the contents. In fact, you should do these three command and post the output: file lh ls -l lh head lh 0 LVL 7 Overall: Level 7 Shell Scripting 4 Unix OS 3 Message Assisted Solution by:Murugesan Nagarajan2009-11-12 Another way to execute lh in the current session: . ./lh 0 LVL 1 Overall: Level 1 Message Expert Comment by:syskrash2009-11-15 Did you ftp the file from windows? Check if the file contains CR/LF or LF at the end of the file (opening in vi should show ^M characters) If this is the case, you can run dos2unix (or dos2ux) to convert the files to UNIX mode. $ dos2unix lh > lh.clean $ chmod 755 lh.clean $ ksh lh.clean 0 LVL 7 Overall: Level 7 Shell Scripting 4 Unix OS 3 Message Expert Comment by:Murugesan Nagarajan2009-11-15 The character mentioned below "^M" can be obtained using the following keys: Control V Control M Command to remove '^M' from the file "lh" and create new file "./lh
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 this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Super User Questions Tags Users Badges Unanswered Ask Question _ Super User is a question and answer site for computer enthusiasts and power users. 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 top How can I resolve the error “cannot execute binary file”? up vote 36 down vote favorite 3 When I login using SSH, all I can see is this... -bash: /usr/bin/id: cannot execute binary file -bash: [: : integer expression expected I couldn't do anything in here. Commands such as halt, poweroff, reboot will return command not found. How can I fix this? I am using Debian Squeeze Linux linux bash ssh debian share|improve this question edited Jun 12 '12 at 22:31 Oliver Salzburg♦ 56.1k35185245 asked Jun 12 '12 at 21:26 superuser 1,85131428 4 What did you do to that machine? –slhck Jun 12 '12 at 21:32 1 the very last thing I did was install logwatch. Nothing else. –superuser Jun 12 '12 at 21:33 3 PATH is an environment variable which contains a list of folders which the shell searches for programs. ls for example, usually refers to /bin/ls, and your shell finds it by going through the folders listed in PATH one-by-one until it finds it, or if it doesn't find it in any of them, it gives up. I suppose a better starting point would be, what is the output of echo $PATH ? (edit: the export command is a way to define an environment variable in bash.) –Darth Android Jun 12 '12 at 21:41 1 Ah... I warned you not to shut the system down :P Can you get console access to it (physical monitor+keyboard attached)? Try booting the system in single-user mode (might be labelled as recovery mode) and see if you can get to a root shell. –Darth Android Jun 12 '12 at 21:51 2 @David you won't see any output after typing export PATH=/bin:/user/bin:/sb