Search code examples
bashshelljobswatch

Can execute binary, but not using "source"


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?


Solution

  • You can only source scripts, not executables. Try:

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