All Questions
Tagged with bash-expansion or bash
27,267 questions
3 votes
5 answers
225 views
How can I use sed to chain append lines from a text file, add it as a suffix to the text on the same lines numbers on another file, and so on?
I've tried using sed for this. I've tried putting the lines of interest in variables as well. I have two examples I want to achieve for now. Lets say I have thousands of urls in a file called links....
3 votes
3 answers
876 views
How do I ensure a bash script argument is a specific value?
The following script is supposed to check $1 and see if it is a specific value. It only works when one Bash [[... =~ ...]] regex check is passed in an if statement. The error is: When more than one ...
1 vote
1 answer
35 views
White spacing is causing variable to not contain all text in result
Disclaimer: I am brand new to bash I'm building a dialog box and trying to get some Docker commands to populate results. I am using this to return a result, which works for the most part. result=($(...
0 votes
2 answers
133 views
Process sed capture group with a bash function before replacement: "sh: 1: <bash function>: not found"
So, I was playing around with this answer, when I found that neither printf_stdin () { read input printf "$input" } sed "/lorem ipsum foobar/ { s/'/'\"'\"'/g s/\...
2 votes
1 answer
35 views
Shell bracket list wildcard doesn't work with variable [duplicate]
The following works: ls {000/487,000/488,000/489,000/490,000/491,000/492} ...many files being listed But this doesn't. Why ? LIST=000/487,000/488,000/489,000/490,000/491,000/492 ls {$LIST} ls: cannot ...
1 vote
0 answers
53 views
Running XFCE on Debian Trixie. Bash history is not saving any sudo commands
Bash history works OK for except for sudo commands. Code from .bashrc follows. How can I modify the behaviour to include anything starting with sudo? NOTE. This behaviour is the same with a brand new ...
2 votes
1 answer
95 views
Bash: function in a script with flags
Using https://stackoverflow.com/a/7948533/31298396, we can implement flags for a script testing as follows: #!/bin/bash # Flags # Source: https://stackoverflow.com/a/7948533/31298396 TEMP=$(getopt ...
0 votes
1 answer
64 views
Bash Script Linux - combines a QUIET function with other functions without hiding some of them
#!/bin/bash DefaultColor="\033[0m" GREEN="\033[32m" RED="\033[31m" PURPLE="\033[35m" YELLOW="\033[33m" CYAN="\033[36m" CmdOk="\033[...