Tag Info

New answers tagged

1

Not an answer, but a formatted comment: $ cat <(cat <<EOF > {"x":[{"a":1,"b":2}]} > EOF) bash: warning: here-document at line 15 delimited by end-of-file (wanted `EOF') bash: warning: here-document at line 15 delimited by end-of-file (wanted `EOF') {"x":[{"a":1,"b":2}]} Put the closing parenthesis on a new line $ cat <(cat <<EOF ...


8

This is just shell variable expansion by bash. In this context whatever is between the curly braces will be iterated and expanded into the expression. $ echo var{1,2,3,4} var1 var2 var3 var4 $ echo var{1..10} var1 var2 var3 var4 var5 var6 var7 var8 var9 var10


5

On OS/X, like on all systems where they are supported except Linux, opening /dev/fd/x is like doing a dup(x), the resulting fd more or less points to the same open file description as on fd x and in particular will have the same offset within the file. Linux is the exception here. On Linux, /dev/fd/x is a symlink to /proc/self/fd/x and /proc/self/fd/x is a ...


2

Since there are several good answers here about using type to find out if a command such as cat is a builtin or an external program. I am going to take a more general approach. There are some commands that must be builtins because they affect the current shell. Three classic examples are cd, exec, and exit. There are some commands that must not be builtins ...


2

Others have already answered about cat, I would just like to explain the issue with echo. If you use type's -a option (list all matches), you will see that echo is both a shell builtin and an external program: $ type -a echo echo is a shell builtin echo is /bin/echo The two are completely independent of one another. type with no options will simply return ...


4

1) Why do we need the curly brackets Because you need to pipe both the output of cat and the output of echo to crontab -. Without the curly braces you can't assemble the output of the two commands in a single pipe. (or can we use single quotes) here Nope. ... | 'cat; echo "0 0 * * * /path/to/cron/job"' | ... means "pipe to an executable named ...


0

fold -w 100 -s text.txt worked for me as I need splitting every line till 100 characters


42

cat is hashed (/bin/cat) is just like cat is /bin/cat (that is, it's an external program). The difference is that you already ran cat in this session, so bash has already looked it up in $PATH and stored the resulting location in a hash table so it doesn't have to look it up again in this session. To see all the commands that have been hashed in your ...


5

Another way to check list of shell builtin : Using compgen which is shell builtin itself! Following command lists all shell builtin commands: compgen -b You can check for cat, echo by greping like:- $ compgen -b | grep echo echo $ compgen -b | grep cat $ You can see compgen -b | grep cat returns with no output, means cat is not shell builtin. Visit ...


4

You can also use the command whereis that is more efficient because it shows where the command is on the machine like also the manual pages library, etc..


58

type tells you what the shell would use. For example: $ type echo echo is a shell builtin $ type /bin/echo /bin/echo is /bin/echo That means that if, at the bash prompt, you type echo, you will get the built-in. If you specify the path, as in /bin/echo, you will get the external command. which, by contrast is an external program that has no special ...


2

For completeness, here is an awk solution: $ awk '{print;} /22/{system("cat file1");}' file2 11 22 aa bb cc 33 44



Top 50 recent answers are included