Tag Info

New answers tagged

0

This answer works in bash-like shells and csh-like shells, and it doesn’t require perl: sh -c '<< other code >>; [ "$0" != "" ] && exit "$0"; exit "$1"' "$?" "$status" or you can add a dummy/pad parameter: sh -c '<< other code >>; [ "$1" != "" ] && exit "$1"; exit "$2"' foo "$?" "$status" and the test can be ...


0

Doesn't look like you can without some magic trickery (ie. there's no option). You can use sh -c, though: $ ssh cshuser@localhost 'sh -c "( ls -d / nosuchfile ) & echo foo; wait"' foo ls: nosuchfile: No such file or directory / IMHO this is the best option anyway, since there are more shells than bash & csh (such as fish), and you have no ...


1

Try using ps to look for the sleep command: { sleep 20; find ...; } & parent=$! if ps --ppid $parent | grep sleep then echo Sleep is running fi


2

{ touch /tmp/sleep.flag; sleep 2d ; rm /tmp/sleep.flag; find /home/disk1/ -exec touch {} \; ; } & Everything what you need just check /tmp/sleep.flag file existance [ -f /tmp/sleep.flag ] && echo "Running sleep..."


0

Use perl: perl -e '$a=shift; `<< other code >>`; exit $a' $? # Fails in csh Edit This works in csh, too (and zsh, tcsh, sh, pdksh, ksh93 - though not fish): perl -e '$a=shift; `<< other code >>`; $a=~s/h// and exit $a; exit shift' "$?h" "$status"


0

The Ctrl-O option has been in Unix since the 110 baud days. Runaway cat commands were always a problem when a long ASCII file was dumped at the slow output device and the the entire file placed in the device driver output buffer. Ctrl-O would start the flush of the buffer and a follow up Ctrl-O would toggle off the flush so the cat could be read at normal ...


2

This is what tmux option c0-change-interval and c0-change-trigger designed for. You should use a screen manager for resumable session anyway.


2

Terminal Setup I reckon this is more to do with the way the terminal is set up, than with any buffering issue. Check the output of stty -a | grep intr, you should have intr = ^C; on the output line if Ctrl-C is enabled at the tty/pty. If it isn't, you can use stty intr ^C to enable it. Add the line to your .tcshrc or .login to make it permanent (or delete ...


-1

open a new console, for example by clicking onto the console icon or by pressing Ctrl+Alt+F2. There, enter killall -9 cat and cat will be killed unless you have a stale NFS lock or an "uninterruptible sleep" situation (read on a bad sector with no timeout set).


-1

When using bash, you can suspend the job using Ctrl+Z and then kill it, either using the PID or by following the answers from https://stackoverflow.com/questions/1624691/linux-kill-background-task (e.g. kill -9 %%)


61

If the file(s) in question contain really lots of data sending the signal can actually get to cat before it finishes. What you really observe is the finite speed of your terminal - cat sends the data to the terminal and it takes some time for the terminal to display all of it. Remember, that usually it has to somehow redraw the whole output window for each ...


-7

You can try with this Reset the display use ctrl-j If cat is still running then open a new terminal and run this pkill -9 -f cat " This will kill all cat processes. "



Top 50 recent answers are included