Questions about bash only, as opposed to other Bourne/POSIX shells. For all Bourne/POSIX-style shells, use the /shell tag instead.

learn more… | top users | synonyms

-1
votes
2answers
22 views

How to prevent symlink from creating within itself?

Running the following command works as expected, creating a symlink to src from include/bb: ln -sf ../src include/bb However, calling the same command again will cause an additional symlink to src ...
3
votes
2answers
21 views

show only physical disks when using df and mount

When I use df or mount, I'm most of all interested in physical disk partitions. Nowadays the output of those commands is overwhelmed by temporary and virtual filesystems, cgroups and other things I am ...
0
votes
2answers
139 views

Why we need to have 2>&1 in /dev/null 2>&1?

I saw in linux script there was a command argument > /dev/null 2>&1, I know it is to redirect the output to null, means silencing it. I also know about the numbering for 0,1,2 (STDIN, ...
1
vote
3answers
213 views

Creating a shell script inside a text editor

I want to know how to create a shell script inside a text editor. So this is what I have inside the text editor. #!/bin/bash mkdir -p temp cd temp if [ $1 > $2 ] ; then echo $1 else ...
-3
votes
1answer
20 views

List the names of file with a certain permission only in the sub directories

So basically, I want to know how to list only the name of the sub directory that has a certain permission. The command I got so far is this: find */* -maxdepth 2 -perm 770 but this just gives me ...
0
votes
4answers
30 views

Difference between open file & open STDIN, when to use each [duplicate]

In very lot of answers, mainly about text-processing commands, I saw commands such as sed, awk, grep, among other, being used with STDIN and the simple open of a file e.g. $ sed -e 's|foo|bar|g' ...
0
votes
2answers
21 views

Alert notification

I wrote simple script which is running all the time and whenever the size of a file is changed it will write something like "The size has changed" to terminal but instead of terminal message, is it ...
0
votes
3answers
46 views

Creating a permanent variable

Is it possible to set "permanent variable" in shell? For example, when I log in I want to print message "Hello user, this is your xxx log in" The number of logins would be stored in permanent ...
1
vote
1answer
32 views

bash adds apostrophes to expanded variable

I am reading in a file inside my bash script where each line consists of multiple columns like this: ANSIBLE 'first run' '--diff --extra-vars "client=yes fast=no"' As you can see, the line consists ...
1
vote
1answer
27 views

How to bind “\C-;” in ~/.inputrc?

I use Meta-ijkl as arrows in Emacs, and M-; as a backspace, so I want to make the keys in bash represent the same style. Moving and deleting works well, but for some reason I cannot bind ...
0
votes
0answers
32 views

How to use df -h for only for path I am currently using for copy files and put the output to variable?

I am looking for a way to check the disk space only for partition which I am using to backup some folders and files to. As an example: I am in folder /var/usr/local/foo and I need to copy this ...
5
votes
1answer
39 views

Make bash exit != 0 when called by AWK and interrupted with ^C

I'm having an issue with the following piece of (G)AWK script: do { ... } while (system("sleep 10")) My intention is to break the loop when the user presses ^C during the sleep, but it's not ...
0
votes
0answers
23 views

Adding source to PATH [on hold]

I want to location to my $PATH so i can execute scripts using only .name . I added command PATH="$PATH:$HOME/bin export PATH to profile.user file when i print "$PATH" its located there. I ...
1
vote
1answer
19 views

Get paths to all sd cards in a computer using GNU bash 4.3.11 running Ubuntu 14.04

how can I get the paths to all sd cards in a computer using GNU bash 4.3.11 running Ubuntu 14.04 and just those? Background: I have an .iso-file and want to create a bash script that asks the user ...
2
votes
1answer
26 views

Sourcing .bashrc from ssh after removing the prompt string check

I have a .bashrc file that needs to be sourced non-interactively. The problem is that on the file there is this return statement preventing from sourcing by code: [ -z "$PS1" ] && return ...

15 30 50 per page