Timeline for Shell script hangs when run with a shebang line
Current License: CC BY-SA 4.0
22 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 18 at 20:10 | comment | added | Aeronautix |
(1) If you run ~/bin/foo or any bash/zsh/Python scripts without a shebang line, do they still hang? (2) Run set -x in the Terminal and run ~/bin/foo , what debugging output do you see (if any) before it hangs? (3) Start a new Terminal and run touch ~/bin/abc; chmod 755 ~/bin/abc; ~/bin/abc , does it hang? (4) Run mkdir ~/bin2; touch ~/bin2/abc; chmod 755 ~/bin2/abc; ~/bin2/abc , does it hang?
|
|
Apr 17 at 14:12 | comment | added | Linc Davis | I don't see where you've tested in safe mode. I suggest trying that next. | |
Apr 17 at 4:56 | comment | added | nohillside♦ | Can you switch to another user account (or create one) and try there? If it happens as well, a reasonable next step would be to reinstall macOS from Recovery Mode. | |
Apr 17 at 4:54 | history | reopened | nohillside♦ | ||
Apr 17 at 3:13 | comment | added | Edward Falk | Edits have been made. | |
Apr 17 at 3:12 | history | edited | Edward Falk | CC BY-SA 4.0 |
added 827 characters in body
|
Apr 16 at 12:26 | comment | added | nohillside♦ | Anyway, please edit the question with the details people asked for in the comment so it can be reopened. | |
Apr 16 at 12:26 | history | closed | nohillside♦ | Needs details or clarity | |
Apr 16 at 12:25 | comment | added | nohillside♦ | @user1934428 I'm not going to argue that :-) I just noticed that it also seems to impact zsh and python. | |
Apr 16 at 11:43 | comment | added | user1934428 |
@nohillside : They are partially covered in the question, i.e. if we can trust that the PATH is really the one stated by the OP; and even then, it could be that sh is an alias or a function, and that sh .... is not running /bin/sh. That's why I would do the test with executing the script from the command line by explicitly writing /bin/sh... I don't trust anything when it comes to such a weird program behaviour.
|
|
Apr 16 at 11:41 | comment | added | nohillside♦ |
@user1934428 The head thing is a good idea, the first two points are already covered in the question.
|
|
Apr 16 at 11:27 | comment | added | user1934428 |
Could it be, that your /bin/sh became corrupt? Doe the script hang too if you explicitly run it with /bin/sh $HOME/bin/foo ? If it runs well, do a head -n 1 ~/bin/foo| xxd and look out for conspicuous hex codes.
|
|
Apr 15 at 13:08 | comment | added | Aeronautix |
Only change the shebang line to #!/usr/bin/env -S -v -i bash and run ~/bin/foo again, do you see any lines prefixed with #env ?
|
|
Apr 15 at 5:50 | comment | added | nohillside♦ |
Which editor do you use to create the script? If you run cat bin/foo > bar; chmod +x bar; ./bar , does it work
|
|
Apr 14 at 22:48 | comment | added | Edward Falk |
Script is not quarantined. ls -leO@ ~/bin/foo returns -rwxr-xr-x 1 falk staff - 29 Apr 13 22:12 /Users/falk/bin/foo
|
|
Apr 14 at 22:45 | comment | added | Edward Falk |
Problem happens with sh, bash, and python3. type sh returns sh is /bin/sh
|
|
Apr 14 at 20:48 | comment | added | ntessore | This has started happening for me as well, today. | |
Apr 14 at 7:33 | comment | added | nohillside♦ | Probably related apple.stackexchange.com/questions/380765/… apple.stackexchange.com/questions/303016/… | |
Apr 14 at 7:12 | comment | added | benwiggy |
If you turn on logging in the Console, and then run it, do you see the same problem? Also, what are the file attributes of foo ?
|
|
Apr 14 at 5:24 | comment | added | nohillside♦ |
Which shell are you running? What does type sh say?
|
|
Apr 14 at 5:19 | history | edited | Edward Falk | CC BY-SA 4.0 |
added 47 characters in body
|
Apr 14 at 5:14 | history | asked | Edward Falk | CC BY-SA 4.0 |