Tag Info

New answers tagged

1

Test on $0 if you have a script: #!/bin/bash echo $0 and make it executable (chmod 755 test.sh) and do: source test.sh you get bash (or something else depending on how you are logged in and what your shell is). If you do ./test.sh you get ./test.sh, so assuming that the script knows how it is saved on the disc you should do: if [ $(basename "$0") ...


0

This happens when a file contains \r\n as a line terminator instead of \n, since \r is a C0 control code meaning "go to the beginning of the current line". To fix, run dos2unix foo.py. Example session: ben@joyplim /tmp/cr % echo '#!/usr/bin/env python' > foo.py ben@joyplim /tmp/cr % chmod +x foo.py ben@joyplim /tmp/cr % ./foo.py ben@joyplim /tmp/cr % ...


0

Could it be a file permission issue? $ chmod +x foo.py If you don't specifically indicate you wish to maintain then they are stripped/altered by most ftp clients.


0

It's not complaining about the /etc/init.d/supervisor file itself, but most likely about the file it wants to execute as - usually the shell that appears on the shebang line in that file. It's a somewhat misleading error that I've seen many times before.


0

I found a solution. I just needed to open a new bash session. Just type "bash" in console and you're ready to go.


1

You need to also link start up fragments like crt1.o and others if you want to call libc functions. The linking process can be very complicated, so you'd better use gcc for that. On amd64 Ubuntu, you can: sudo apt-get install gcc-multilib gcc -m32 -o test test.o You can see files and commands for the link by adding -v option.


1

readelf or objdump both can do this. ELF file compiled by gcc will add .note.ABI-tag and .note.gnu.build-id two sections. both could displayed by objdump -sj .note.ABI-tag ELFFILE objdump -sj .note.gnu-build-id ELFFILE option "s" means display full contents, "j" for indicate section name. This style get hex contents of that sections. readelf -n will ...



Top 50 recent answers are included