1
vote
3answers
149 views

What is $() in a command?

What is $() in Linux Shell Commands? For example: chmod 777 $(pwd)
29
votes
5answers
725 views

How to save a command you entered without executing it? [duplicate]

Every Linux user has experienced this annoying thing: you begin typing a long and boring command, then realise you should have executed another one before. How to save the first one to execute it ...
7
votes
2answers
282 views

Change the order of executables started in bash

If I execute the test command in bash, test(evaluates conditional expression) built-in utility is started: $ type test test is a shell builtin $ type -a test test is a shell builtin test is ...
5
votes
2answers
294 views

Get the actions for a command programmatically

Let's take the git example: $ git<TAB><TAB> git git-import-dscs git-shell git-buildpackage git-import-orig git-upload-archive git-dch git-pbuilder ...
1
vote
2answers
26 views

Install-on-Demand Wrapper Function for Executables

How do I make the following function work correctly # Install git on demand function git() { if ! type git &> /dev/null; then sudo $APT install git; fi git $*; } by making git $* ...
4
votes
2answers
396 views

Command completion does not complete the files in the current directory

Something is wrong with my tab completion. Let's say I do this: cd test // works fine, go into test directory ls // works fine, displays all of the files Let's assume I have the following files: ...
20
votes
2answers
665 views

How do I move all files output from a command?

I have this grep command to find files without the word Attachments in them. grep -L -- Attachments * I want to move all the files that are output from that command. How do I do that in bash? Do I ...
5
votes
3answers
807 views

What does “rm is hashed” mean?

I'm going through http://mywiki.wooledge.org/BashGuide/CommandsAndArguments and came across this: $ type rm rm is hashed (/bin/rm) $ type cd cd is a shell builtin Just a little earlier, the guide ...
3
votes
3answers
452 views

Correctly parse arguments in script behaving like a shell called through SSH

I have a server with a very limited used whom I want to be able to run two very specific (and custom) instructions through SSH. In order to do that, I have set the shell for that limited user to be a ...
3
votes
1answer
116 views

command not found handle doesn't work for url

I'm trying to setup the command_not_found_handle for URL links, %> command_not_found_handle() { echo "OK"; } %> aaaaa OK %> http://www.google.com bash: http://www.google.com: No such file or ...
1
vote
2answers
99 views

Using globbing/wildcards when Opening Files from Terminal

I have a folder A. Inside the folder, there are some files a,b,c,d and there is a subfolder, B, containing files e,f,g. Suppose I want to open files a,b,c,d: then I just type xdg-open *. However, ...
1
vote
4answers
359 views

How can I force the use of a specific binary when running a script

How can I force a specific binary to be used when executing a bash script? I have a bash script which uses the "php" binary. There are several php versions on my computer. The main php binary, as ...
1
vote
0answers
56 views

Using alot MUA with nottoomuch-addresses

I try to use the MUA alot to work with the nottoomuch-addresses.sh script for autocompletion of addresses within alot like described in: ...
1
vote
1answer
162 views

Execute command supplied by function parameters

I'm trying to create a function method in a bash script that executes a command which is supplied to the method by the paramters. Meaning somethings like this: special_execute() { # Some code ...
0
votes
4answers
4k views

How to create custom commands in Unix/Linux? [closed]

I'm a newbie in Unix/Linux environment. Can anyone guide me to create custom commands in Unix/Linux. Thanks in advance
1
vote
1answer
392 views

Bash command that uses wildcard in place of folder to copy folder contents of multiple files into one directory?

I have a directory ~/dir that contains a bunch of random folders like: ~/dir/av 801 and ~/dir/lm 320. I want to copy the contents of every inner folder (ie: av 801) into a different directory. The ...
4
votes
4answers
571 views

What does <<< mean? [duplicate]

What does <<< mean? Here is an example: $ sed 's/a/b/g' <<< "aaa" bbb Is it something general that works with more Linux commands? It looks like it's feeding the sed program with ...
8
votes
0answers
208 views

how to get exit status from the command before the last [duplicate]

I have solaris machine ( solaris 10 ) please Look on the following simple commands (haconf -makerw | grep -iq "Cluster already writable") # haconf -makerw VCS WARNING V-16-1-10364 Cluster ...
3
votes
2answers
207 views

Make copies of a single directory to multiple directories with different names

I'm trying to replicate a single directory (with sub-directories) to a bunch of new directories based on a list. For example I can: mkdir Fred Barney Thelma Louise Foo Bar How would I copy a premade ...
5
votes
3answers
1k views

Test command in unix doesn't print an output

When I type this in the terminal test 4 -lt 6 I don't get any output. Why not? I need that 0 or 1
4
votes
3answers
2k views

Split command output by linebreak?

I have a command returning multiple lines. For further processing I need to process each single line of those lines. My current code works by modifying the IFS (Internal Field Separator): ...
5
votes
1answer
810 views

Git auto-complete

I am using Git as many of you do. Also, I don't use any GUI for that — just CLI. So I was wondering: are there any way to make Git commands (git status, git checkout etc.) complete themselves when ...
0
votes
1answer
85 views

Why does this compound command report errors when copying directories? [duplicate]

Possible Duplicate: Why does this compound command report errors when copying directories? if one executes the following two commands in one line, as follows, rm -rf dir ; cp -r dir2 ...
0
votes
2answers
193 views

Why does this compound command report errors when copying directories?

if one executes the following two commands in one line, as follows, rm -rf dir ; cp -r dir2 dir it may complain that cp can not create directory dir/subdir: File exists but if these two commands ...
-1
votes
1answer
2k views

Check if the command exists in bash

I want to check if a given command exists in bash and I care only about the native commands of the bash and not the scripts written by the user. When I refer to native commands I mean all those ...
3
votes
1answer
1k views

Make awk use bash with the system() command

Is there a way to make awk use bash instead of sh when running system commands using the system() call? I want to use some bash-specific features such as [[ ]] and < > string comparison operators: ...