Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
-4 votes
4 answers
94 views

I'm working on the following pipeline (codeshare.io/243VJE): #!/bin/bash #SBATCH --nodes=1 --ntasks=1 --cpus-per-task=10 #SBATCH --time=2-00:00:00 #SBATCH --mem=40gb # #SBATCH --job-name=pan_pca #...
Matteo's user avatar
  • 387
6 votes
3 answers
559 views

I'm in the following situation > ls H9/ HG01109_chr1_hap1_contigs.list HG01952_chr1_hap2_contigs.list HG02572/ HG03486_chr1_hap1_contigs.list ...
Matteo's user avatar
  • 387
0 votes
0 answers
21 views

The situation: I've been converting my family to Linux for quite some time now. I'm currently in the process of replacing their Roku with a Media PC (in this specific case, Pop_OS! 24.04 using Wayland ...
lilHar's user avatar
  • 125
6 votes
2 answers
743 views

$ sleep 1234& $ sleep 12345678& $ %sleep\ 1234 bash: fg: sleep 1234: ambiguous job spec $ jobs [1]- Running sleep 1234 & [2]+ Running sleep 12345678 & ...
Dan Jacobson's user avatar
0 votes
0 answers
47 views

Description I have two Raspberry Pi OS 13 (Trixie) systems with identical Bash versions and identical /bin/bash binaries (verified with md5sum). On one system, running bash -l sources ~/.bashrc as ...
Pixie 's user avatar
0 votes
0 answers
43 views

I have a little maintenance thing to do as super user, from time to time. I would like that to be a one-liner, for easy copying from my self-documentation to a terminal. I reduced it to the bare ...
db-inf's user avatar
  • 333
0 votes
0 answers
36 views

I created this function, which is supposed to allow an interactive selection of an mDNS hostname, and then connect to it via ssh. Yet, whatever I try, the host variable is only available in side the ...
Daniel D.'s user avatar
  • 175
0 votes
1 answer
70 views

I have just pasted a line into the bash shell. It contains embedded newlines. CTRL+a gets me to https at the start. CTRL+e gets me to 7d87 at the end. How can I move around from line 1 to 2 to 3 ...
Dan Jacobson's user avatar
3 votes
2 answers
349 views

I'm writing a script and I'd like to use set -o pipefail on shells that support it. Dash does not support that option. Usually, || true lets me swallow errors, but not in case of set: > podman run ...
Ark-kun's user avatar
  • 191
1 vote
1 answer
46 views

It often happens that I have some long task running, like compiling a program, running tests or copying large archives. Once I am done with whatever else I was doing, I want to leave the computer ...
Dominik Kaszewski's user avatar
5 votes
3 answers
896 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
0 votes
1 answer
77 views

I just rebooted one of my systems for the first time in several months, restarted tmux and my usual set of bash shells for tailing various log files, and noticed that running fg n (i.e. fg followed by ...
cas's user avatar
  • 85.1k
2 votes
3 answers
207 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
3 votes
6 answers
433 views

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....
shrykullgod's user avatar
0 votes
0 answers
70 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,471
3 votes
3 answers
917 views

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 ...
EmberNeurosis's user avatar
4 votes
1 answer
222 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,496
1 vote
1 answer
49 views

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=($(...
James Durand's user avatar
0 votes
2 answers
158 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
0 votes
1 answer
56 views

I just wanted to build a simple bash script that inverted a 'hex color code' (made up of 3 pairs of 2-digit hexadecimal numbers, in the format #RRGGBB). In my first code block I attempt to perform ...
Signor Pizza's user avatar
2 votes
1 answer
47 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
11 votes
1 answer
1k views

The test [[ -n $1 ]] yields True if the length of string is non-zero. But I've seen elsewhere and have tried using just [[ $1 ]] without the primary -n and it seems to have the same effect. Is there ...
CertainPensioner's user avatar
1 vote
0 answers
84 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
1 vote
1 answer
91 views

Suppose we have the file ./testing with contents #!/bin/bash # Flags # Source: https://stackoverflow.com/a/7948533/31298396 TEMP=$(getopt -o ''\ --long first,second \ -...
Grass's user avatar
  • 145
2 votes
1 answer
110 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
5 votes
2 answers
563 views

If I enter pwd foo bar at the prompt of the bash shell, the foo bar part of the command line seems to be completely ignored. If I enter exit 0 foo, I get bash: exit: too many arguments. So pwd ignored ...
Enlico's user avatar
  • 2,362
0 votes
1 answer
82 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
0 votes
2 answers
61 views

I have a file named .ps1, and I'm running source .ps1 in bash to try and set my prompt up with color. The contents of the .ps1 file are: __prompt_command() { local EXIT="$?" local ...
iLiekTaost's user avatar
5 votes
1 answer
422 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
0 votes
1 answer
108 views

I tried to do this: curl "https://imslp.org/wiki/Goldberg-Variationen%2C_BWV_988_(Bach%2C_Johann_Sebastian)" | perl -nle 'print "$1" while /<span id="num-of-ratings-[0-9]{6}...
Signor Pizza's user avatar
6 votes
2 answers
348 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
0 votes
2 answers
109 views

I have a few RHEL 8/9 boxes with a cron job that updates them automatically every week. The reboots are done manually from time to time and I would like to write a script to simplify the removal of ...
Fravadona's user avatar
  • 1,668
4 votes
3 answers
252 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
-4 votes
3 answers
168 views

I want this command prompt. Any ideas?
Danijel's user avatar
  • 224
-5 votes
1 answer
95 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
0 votes
1 answer
49 views

$ bind -V | grep horiz print-completions-horizontally is set to `off' How do I set it to `on' from the bash command line? I know how to set it in ~/.inputrc. That's not my question.
Dan Jacobson's user avatar
2 votes
1 answer
260 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
4 votes
2 answers
300 views

I have this integrated in a bash-script on an outdated Debian 10. ps -axo "%p ;;; %a" Works well, output is like 10161 ;;; [kworker/0:1-cgroup_destroy] 12173 ;;; [kworker/2:0-events] 12379 ;...
chris01's user avatar
  • 1,049
1 vote
3 answers
211 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
-10 votes
1 answer
129 views

Downloading an image and encoding it into base64: curl -o output.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/USA-San_Jose-De_Anza_Hotel-3.jpg/500px-USA-San_Jose-De_Anza_Hotel-3.jpg ...
Franck Dernoncourt's user avatar
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
7 votes
1 answer
392 views

Consider an associative array in bash (versions 5.2.15(1)-release and 5.2.21(1)-release): declare -A ufs=(); ufs["one"]=1; ufs["two"]=2; ufs["three"]=3 printf '> %s\n' ...
Chris Davies's user avatar
10 votes
5 answers
635 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
4 answers
492 views

I would like to be able to find all files in multiple directories whose file names start with the same string, but preferably not if that string is only one word or contains fewer than perhaps 5 ...
EmmaV's user avatar
  • 4,443
4 votes
1 answer
867 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
1 vote
2 answers
134 views

I need to pipe data through SSH to a command that reads stdin. The command needs to run with sudo so I need to be able enter the sudo password, too. Without ssh, I'd use numbered file descriptors like ...
con-f-use's user avatar
  • 434
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
2 votes
1 answer
223 views

Using cal and ncal, I know that I can display a certain number of months using various flags (for example, ncal -C -A 4 will show the current month and the 4 months after). What I am trying, and so ...
m_mlvx's user avatar
  • 148
-1 votes
2 answers
117 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
14 votes
1 answer
649 views

Recently i noticed that when i try to "tab-tab" complete a filename for some gtk applications (i do not use gnome) i get dbus errors. for example: $ inkscape pu (tab-tab, to complete the ...
gcb's user avatar
  • 953

1
2 3 4 5
546