Tag Info

New answers tagged

1

There is no. Very easy to write one with perl. Here's untrap script: #!/usr/bin/perl $SIG{INT} = "DEFAULT"; exec { $ARGV[0] } @ARGV or die "couldn't exec $ARGV[0]: $!"; Example usage: #!/bin/bash untrap bash -c ' sleep 3 echo aaa ' & trap '' INT wait $! If you remove untrap prefix, Ctrl-C won't kill the script. More versatile script: ...


2

Chet Ramey says: in POSIX mode, the vi editing mode should not map tab to complete. This is because POSIX.2 completely specifies the behavior of the vi editing mode, and the standard requires tab to be mapped to self insert by default. Add the following line to ~/.inputrc: TAB: complete Or you can add bind 'TAB: complete' to ~/.bashrc


4

sed's API is primitive - and this is by design. At least, it has remained primitive by design - whether it was designed primitively at inception I cannot say. In most cases the writing of a sed script which, when run, will output another sed script is a simple matter indeed. sed is very often applied in this way by macro preprocessors such as m4 and/or make. ...


0

If your grep supports PCRE (Perl-compatible regular expressions) : $ grep -Po '.*/\Kfoo[^/]*$' file.txt foobar foo .*/ will match upto the last / and \K will discard the match foo[^/]*$ will find the filenames starting with foo


1

If foo must match at the start of the basename: < inputfile grep '/foo[^/]*$' /foo[^/]*$: matches a /foo string followed by any number of any character not / at the end of the string if foo can match anywhere in the basename: < inputfile grep 'foo[^/]*$' foo[^/]*$: matches a foo string followed by any number of any character not / at the end ...


4

As mikeserv explains, POSIX doesn't specify tput cup. POSIX does specify tput but only minimally. That said, tput cup is widely supported! The standardised way of positioning the cursor is using ANSI escape sequences. To position the cursor you'd use something like printf "\33[%d;%dH%s" "$Y" "$X" "$CHAR" which will print $CHAR at line $Y and column $X. A ...



Top 50 recent answers are included