Tag Info

New answers tagged

1

runuser is a recent command, it appeared in util-linux 2.23. Ubuntu 14.04 ships util-linux 2.20, so it doesn't have this command yet. runuser isn't very useful. Just use su instead. Note that the command runuser user -c 'cd' doesn't actually do anything — the scope of cd does not extend to the next call to runuser. You'd have to use runuser user -c 'cd ...


0

xprop -root 2>/dev/null | sed -n '/^_NET_ACTIVE_WINDOW/ s/.* // p'


1

From a look at the man page, it seems that install will not do what you want. Indeed, the Synopsis section indicates a usage of the form: install [OPTION]... -d DIRECTORY... and later on, the man page says: -d, --directory treat all arguments as directory names; create all components of the specified directories So it seems ...


6

zsh: $ text='The cat hopped in a box.' $ chars=(${(s::)text}) $ print -aC$#chars $chars {1..$#chars} T h e c a t h o p p e d i n a b o x . 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24


7

It's very simple to use the shell and basic tools: $ echo "The cat hopped in a box." | (read a ; echo $a | sed 's/./& /g' ; seq -ws" " 01 ${#a}) T h e c a t h o p p e d i n a b o x . 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Explanation The string is read into the $a variable. The ...


8

Here's a hybrid perl/fold approach: $ echo "The cat hopped in a box." | fold -w 1 | perl -lne 'push @k, "$_ "; push @l,sprintf "%-2s",$.; END{print "@k\n@l"}' T h e c a t h o p p e d i n a b o x . 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Explanation fold -w 1: this will fold the ...


2

You can use perl: $ echo The cat hopped in a box. | perl -nle ' printf "%-3s", $_ for split //; printf "\n"; printf "%-3s", $_ for 1..length' T h e c a t h o p p e d i n a b o x . 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24



Top 50 recent answers are included