Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
0 votes
2 answers
71 views

I am using this code to parse the first argument passed to my script. It error handles and it works just the way I want it: if [ -z "$action" ]; then printf "[${c_RED}ERROR${c_RESET}...
EmberNeurosis's user avatar
2 votes
3 answers
161 views

I have a script that parses command line arguments. The intro to the loop to iterate over the argument array looks like this: for arg in ${args[@]+"${args[@]}"}; do Can someone explain this ...
OneCheapDrunk's user avatar
0 votes
0 answers
51 views

Hex memory dump is Docsis config file. Is it possible to convert this hex dump info valid Docsis config file? Preferably, using Perl and DOCSIS::ConfigFile module. (or Python scripts, python-docsis). ...
Lexx Luxx's user avatar
  • 1,473
4 votes
1 answer
180 views

Suppose we have a script named test_sort in our $PATH with the following contents: #!/bin/bash function echo_text () { printf -- "%s\n" "$fc$oc$fs$lc" printf -- "%s\n&...
Melab's user avatar
  • 4,478
0 votes
2 answers
137 views

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/\...
Grass's user avatar
  • 145
2 votes
1 answer
36 views

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 ...
dargaud's user avatar
  • 659
1 vote
0 answers
53 views

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 ...
imazed's user avatar
  • 11
2 votes
1 answer
97 views

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 ...
Grass's user avatar
  • 145
0 votes
1 answer
64 views

#!/bin/bash DefaultColor="\033[0m" GREEN="\033[32m" RED="\033[31m" PURPLE="\033[35m" YELLOW="\033[33m" CYAN="\033[36m" CmdOk="\033[...
Maxime's user avatar
  • 3
5 votes
1 answer
375 views

Common method for preventing concurrent runs for a given script is utilizing flock as: LOCK=/var/lock/my-lock exec 9>>"$LOCK" if ! flock --exclusive --nonblock 9; then echo "...
basher's user avatar
  • 71
6 votes
2 answers
331 views

var="$(cat no-exists)" var="$(< no-exists)" give a similar output: cat: no-exists: No such file or directory bash: no-exists: No such file or directory I'll describe the ...
Mario Palumbo's user avatar
4 votes
3 answers
219 views

Short version: I am at a bash command line. In some directory, I can ls various files and see their names. I would like to get something like the ASCII character code for each character in a file's ...
ASV's user avatar
  • 43
-5 votes
1 answer
86 views

The bash' command source has been modified in one of few ways: alias function overriding or else Then how can its synonym: . got being so too (problem is it's not letter) ?
user17227456's user avatar
2 votes
1 answer
243 views

I am running a Ubuntu system on my Radxa Zero 3E (single board computer) Using its GPIO I am driving a 5V LED via an NPN transisitor. Everything works. For switching it on I use gpioset $(gpiofind ...
nightcrawler's user avatar
1 vote
3 answers
183 views

I have a list of bash commands that I'd like to execute one at a time. They could be in a file, or the terminal, or whatever is necessary. But I'd like to execute the first one then I'd check the ...
Mike's user avatar
  • 290
15 votes
2 answers
2k views

I'm in Linux and in Bash. I expect seq 1000000 | tee /dev/stdout to always output 9 numbers from 1 to 9 and their duplicates (18 in total). But when I do seq 1000000 | tee /dev/stdout | grep -c '^[1-...
decision-making-mike's user avatar
10 votes
5 answers
610 views

With grep I can filter lines. But if the lines are pretty long it gets messy. How can I only get "some chars around" my search-string? f.txt this is a red cat in the room this is a blue ...
chris01's user avatar
  • 1,049
4 votes
1 answer
835 views

I found out I don't totally understand how bash file descriptors work. I would like to have some guidance here. I have a scenario where I need to read the content of a file, and for each line of the ...
sylye's user avatar
  • 718
0 votes
0 answers
29 views

I have a faulty command several times in my history and want to remove it with history -d <id_of_faulty_command>. I can identify this via a --writeout (instead of the correct --write-out) Now ...
vrms's user avatar
  • 287
-1 votes
2 answers
104 views

Welcome to Termux Docs: https://doc.termux.com Community: https://community.termux.com Working with packages: - Search: pkg search <query> - Install: pkg install <package> - ...
Swudu Susuwu's user avatar
12 votes
2 answers
1k views

I was debugging one script, and discovered unexpected behavour of handling arithmetic syntax error. Normally, when error happens, script is just continuing execution. #!/bin/bash func2 () { echo &...
Ashark's user avatar
  • 1,209
2 votes
1 answer
67 views

I have a script read.sh: read -ei "hello world" eval $REPLY Upon executing chmod +x read.sh and then running ./read.sh, I notice that pressing Esc followed by b or w jumps between the ...
luna's user avatar
  • 25
0 votes
0 answers
37 views

The command echo ${PATH//:/$'\n'} should replace colons with new lines. However, I am getting spaces. What am I doing wrong here?
Florian's user avatar
1 vote
2 answers
116 views

Consider this one-liner bash example: $ (function test() { echo "testing a string" | grep "a" | sed 's/i/y/g'; }; set -x; test | grep "test" ) + grep --color=auto test + ...
sdbbs's user avatar
  • 590
0 votes
1 answer
66 views

In the tcsh shell, the elements of the directory stack can be access on the command line using =<#>, e,g, =0 =1 .... and a sampled command like: cp Something =1/ would copy file Something to ...
Evan Fishbein's user avatar

1
2 3 4 5
546