Question

Trying to get watch jobs to work. This is tricky because jobs reports jobs owned by the current shell, and watch creates another shell. Therefore I would like to run . watch jobs or source watch jobs, but I get this error:

-bash: source: /usr/bin/watch: cannot execute binary file

Here is the output of file /usr/bin/watch:

/usr/bin/watch: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, BuildID[sha1]=0xe207fd209faf781a58f5f30922c99da759bd3953, stripped

How to debug source in this case?

Était-ce utile?

La solution

You can only source scripts, not executables. Try:

while true; do clear; jobs; sleep 2; done

Autres conseils

You cannot source in a binary file in shell, it is meant for shell scripts only.

source command is used for executing a shell script in current process only, without forking a new sub-shell process.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top