Tag Info

New answers tagged


It easy can be done by adding less command to special variable LESS: LESS=+/-T man ls where /-T is less command /find -Tpattern


You can do that piping man though less and using the -p flag: -ppattern or --pattern=pattern The -p option on the command line is equivalent to specifying +/pattern; that is, it tells less to start at the first occurrence of pattern in the file. Examples: man ls | less -p -T man git-log | less -p -S Since you'll land ...


cmd tty tty returns the name of the terminal connected to stdout.


If your shell supports them, the simplest way of doing such manipulations would be to use process substitution: <(…) and >(…). This works in bash, zsh and ksh and possibly other shells. For example: $ sort <(printf "b\nc\na\n") a b c $ ls foo $ cp <(find . -name foo) bar $ ls bar foo However, this won't help in the example you state since ...


Or use a command substitution; this command is intrinsically redundant, but just to showcase the method: cat "$(<<< "files" sed 's/s//')" will cat a file named file in your current working directory.


From the pdftotext man page: If text-file is ´-', the text is sent to stdout. So in this case all you need is: pdftotext "C BY BRIAN W KERNIGHAN & DENNIS M RITCHIE.pdf" - Or if you want to pipe this to STDIN of another program: pdftotext "C BY BRIAN W KERNIGHAN & DENNIS M RITCHIE.pdf" - | another_prog Using - as substitute for a ...


If the said program supports to write to any file descriptor even if it can't seek, you can use /dev/stdout as output file which is a symlink to /proc/self/fd/1 on my system. File descriptor 1 is stdout.


Yes, you should first check if there are any arguments or not and then proceed. if [ $# -gt 0 ] then for myvar do if ! [ -e "$myvar" ] echo "$myvar cannot be found." exit fi echo "This is the filname:" $myvar cut -f1 -d, $myvar > social_security cut -f2 -d, $myvar > ...


Think about the first line of your script: for myvar. How many times will this for loop be executed if there are no arguments?


I think there's more to this: Either that's not the command you're using - or else somewhere else in the function you're doing it differently. That error comes from ${1?}. Or it comes from your test, but only if you first do set -u. To fix that, stop doing that. Do set +u; fn_name, and see what happens. And if you have any ${1?} expansions in there, that ...


You need to separate the arguments to [ with spaces; also, the equality operator is a single =, and you should quote both sides: if [ "$ARG" = "clean" ]; then

Top 50 recent answers are included