Bin/sh Not Found Error
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 Business Learn bin sh syntax error unexpected more about hiring developers or posting ads with us Super User Questions Tags Users Badges Unanswered system bin sh not found Ask Question _ Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a bin sh command not found 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 Linux sh script throws “#!/bin/sh: not found” up vote 1 down vote favorite
Interpreter Bin Sh Not Found
1 i have a script #!/bin/sh # Automatically remove a torrent and delete its data after a specified period of # time (in seconds). TARGET=/var/www/transmission/completed USER=name PASS=pass BIN="/usr/bin/transmission-remote" # The default is 5 minutes (in seconds). CUTOFF=`expr 100 \* 3` ############################################## ### You shouldn't need to edit below here. ### ############################################## # Tokenise over newlines instead of spaces. OLDIFS=$IFS IFS=" " for ENTRY in `$BIN -n $USER:$PASS -l | grep 100%.*Done.*Finished`; do # Pull the ID out bin sh 1 not found of the listing. ID=`echo $ENTRY | sed "s/^ *//g" | sed "s/ *100%.*//g"` # Determine the name of the downloaded file/folder. NAME=`$BIN -n $USER:$PASS -t $ID -f | head -1 |\ sed "s/ ([0-9]\+ files)://g"` # If it's a folder, find the last modified file and its modification time. if [ -d "$TARGET/$NAME" ]; then LASTMODIFIED=0 for FILE in `find $TARGET/$NAME`; do AGE=`stat "$FILE" -c%Y` if [ $AGE -gt $LASTMODIFIED ]; then LASTMODIFIED=$AGE fi done # Otherwise, just get the modified time. else LASTMODIFIED=`stat "$TARGET/$NAME" -c%Y` fi TIME=`date +%s` DIFF=`expr $TIME - $LASTMODIFIED` # Remove the torrent if its older than the CUTOFF. if [ $DIFF -gt $CUTOFF ]; then date echo "Removing $NAME with ID:$ID" $BIN -n $USER:$PASS -t $ID --remove-and-delete fi done IFS=$OLDIFS but when i try to run it i get this error: /root/transmission_r.sh: 1: /root/transmission_r.sh: #!/bin/sh: not found linux ubuntu bash sh share|improve this question edited Aug 1 '15 at 11:13 Arjan 22.6k95598 asked Aug 1 '15 at 10:58 Nojus741 612 ...so, what does ls /bin/sh give you? –Arjan Aug 1 '15 at 11:14 it gives me: /bin/sh –Nojus741 Aug 1 '15 at 11:18 1 Any funny characters on that first line then? –Arjan Aug 1 '15 at 11:21 i.imgur.com/V6V4OJw.png –Nojus741 Aug 1 '15 at 11:22 4 Ahh, got it, file encoding was set to UTF-8, i set
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 bin sh not found ubuntu Business Learn more about hiring developers or posting ads with us Unix & Linux Questions
Bin Sh Source Not Found
Tags Users Badges Unanswered Ask Question _ Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD
Bin Sh Bc Not Found
and other Un*x-like operating systems. 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 Why http://superuser.com/questions/948862/linux-sh-script-throws-bin-sh-not-found does sh say “not found” when it's definitely there? [duplicate] up vote 11 down vote favorite 3 Possible Duplicate: “No such file or directory” lies on Optware installed binaries I'm trying to add ebtables to a little router box. I went and got a binary compiled for the correct architecture, and put it on the box in /sbin/. When I do /sbin/ebtables, the shell says /bin/sh: /sbin/ebtables: not found, but I can do ls -l /sbin/ebtables and http://unix.stackexchange.com/questions/18061/why-does-sh-say-not-found-when-its-definitely-there it shows up perfectly: -rwxr-xr-x 1 admin admin 4808 Aug 4 10:36 /sbin/ebtables Any ideas about what's going on here? embedded router command-not-found share|improve this question asked Aug 4 '11 at 15:14 Shawn J. Goff 22k1378109 marked as duplicate by Gilles, Caleb, Shawn J. Goff, Michael Mrozek♦ Aug 6 '11 at 6:59 This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. you are logged in using admin ? –mr_eclair Aug 4 '11 at 15:16 Yes, it's a single-user system. All the other commands also are owned by admin:admin, and I can run them just fine. –Shawn J. Goff Aug 4 '11 at 15:17 add a comment| 2 Answers 2 active oldest votes up vote 13 down vote accepted It could be a missing dependency. Notably you'll get that type of message if the runtime linker ("program interpreter") set in the ELF header does not exist on your system. To check for that, run: readelf -l your_executable|grep "program interpreter" If what it gives you does not exist on your system, or has missing dependencies (check with ldd), you'll get that strange error message. Demo: $ gcc -o test t.c $ readelf -l test|grep "program interpreter" [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] $ ./test hello! $ gcc -Wl,--dynamic-linker -Wl,/i/dont/exist.so -o test
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 http://stackoverflow.com/questions/13702425/source-command-not-found-in-sh-shell Us Learn more about Stack Overflow the company Business Learn more 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 Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up source command not found in not found sh shell up vote 34 down vote favorite 11 I have a linux script which uses sh shell. I hit an error in a line which uses a "source" command. Basically, it seems "source" is not included in my sh shell. If I enter sh and enter source I get: sh: 1: source: not found Should I explicitly install "source"? Do I have a wrong version sh not found of sh shell? linux shell ubuntu sh share|improve this question edited Jun 27 at 20:21 mana 2,69532345 asked Dec 4 '12 at 12:01 Milad 3992715 1 One could reasonably argue that a shell which supports source is a "wrong version". –William Pursell Dec 4 '12 at 12:08 Also, the error message source: not found means that the source command was evaluated properly, but the file it should have read does not exist. –Simon Richter Jan 7 '14 at 6:43 add a comment| 7 Answers 7 active oldest votes up vote 33 down vote accepted /bin/sh is usually some other shell trying to mimic The Shell. Many distributions use /bin/bash for sh, it supports source. On Ubuntu, though, /bin/dash is used which does not support source. If you cannot edit the script, try to change the shell which runs it. share|improve this answer answered Dec 4 '12 at 12:26 choroba 105k1089146 2 Thanks! Replacing /bin/sh with /bin/bash did work on Ubuntu! I'm curious why though, does it mean on Ubuntu bash is sh? –Milad Dec 4 '12 at 12:51 1 @Milad: On recent Ubuntus, /bin/sh calls /bin/dash. Traditionally, /bin/sh called /