Questions specific to GNU’s Bourne Again SHell, as opposed to other Bourne/POSIX shells. For questions about Unix shells in general, use the /shell tag instead.

learn more… | top users | synonyms

1
vote
0answers
7 views

Bash test: what does “=~” do?

#!/bin/bash INT=-5 if [[ "$INT" =~ ^-?[0-9]+$ ]]; then echo "INT is an integer." else echo "INT is not an integer." >&2 exit 1 fi What does the leading ~ do in the starting regular ...
0
votes
1answer
23 views

Formating another column in bash

In order to check how many IPs are connected to my server I use the command as follows. sudo awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr Display unique IP's in second ...
0
votes
0answers
18 views

How to get data in correct order from terminal using Expect

I'm using Expect to automatize the following tasks in a switch: log in via telnet ask for neighbors (devices conected directly to the switch) save neighbors information into a text file. Check if ...
0
votes
1answer
10 views

Installing cyberoam client on Kali Linux(Bash says no file or directory found)

I can see the file when I invoke ls, but when I try to access the file, BASH exits with the following error. bash: ./crclient: No such file or directory
1
vote
2answers
70 views

Bash: Show the contents of a text file, with every occurrence of a word highlighted [duplicate]

How can I show the contents of a text file, with every occurrence of a word highlighted?
0
votes
0answers
28 views

Pass filter into “find” command in bash/shell?

My code look likes the following one: find . \( -name "1" -o -name "2" -o -name "3" ... \) ... There could be a lot of params inside brackets. Is it possible to form a filter list and save it into a ...
-1
votes
0answers
39 views

bash script gives error under Line 11: no file or directory [on hold]

I have a server running with ubuntu,nginx and HHvm. There I have a script wich should delete all Domains from a file. This File is called "Domainsfile.txt" In the same directory where the Domainsfile....
-1
votes
1answer
22 views

How to compare a list of hashes (line by line) against another list of hashes?

(Using Bash) I am trying to compare a list of hashes against another list of hashes; am thinking a nested for loop or a while loop for each line and then an if statement. Compare the first line to the ...
3
votes
1answer
131 views

Strange 'sh -c' behavior when run through ssh [duplicate]

I am trying to run a few commands through ssh and getting confused with the behavior of sh -c: ssh myhost sh -c 'echo starting; who -b; date; echo $SHELL' Output (note: the echo's output is just a ...
4
votes
1answer
43 views

Selecting non-existent files with wildcard/regex

I'm trying to convert hundreds of *.jpg files to *.webp files with libwebp on macOS. Particularly, I want to use the command line tool cwebp to perform the conversion. It works like this: cwebp <...
3
votes
1answer
33 views

Erase character with BackSpace on a bash command line

I have a configuration for bash and profile files, but I copied that file to other server so now I can't erase text only by pushing backspace, I need to press Shift + Backspace to erase text. What is ...
-4
votes
1answer
35 views

About bash : cd: too many arguments in my vmware kali linux

can anyone please help me with this anyone help me out please...
1
vote
1answer
20 views

Newbie bash script

I am a newbie in bash scripting and writing a simple bash script to show system information. Here is my code: #!/bin/bash hostn=$(hostname) system=$(uname -a) cpu=$(cat /proc/cpuinfo | grep "model ...
1
vote
2answers
42 views

Using “Find” Command in tandem with “if” “and” statements

I need to search and find sub-directories that contain a certain file, however if they contain this certain file + this other file, I do not want them to be listed. The statement looks something like ...
4
votes
1answer
48 views

Access variables set inside command substitutions

I wrote a simple script #!/bin/bash -x selentry=`ls -l / | sort ; ts=${PIPESTATUS[0]}` echo $ts but $ts show nothing. How i can display $ts variable? or how i can get exit status code from ...

15 30 50 per page