Skip to main content

New answers tagged

0 votes

how to fix the weird error “Operation not permitted”

I saw a similar (and puzzling) error. Turned out to be fapolicyd - yet another service for restricting access. No warnings anywhere (by default). Try stopping the service, to see if it solves your ...
Preston L. Bannister's user avatar
0 votes

How can I find the RFC file that covers a particular topic?

You can use the grep command with the -r (recursive) and -z (decompress) options for a more efficient search. Here's an alternative approach: findrfc() { zgrep -i "$1" /usr/share/doc/rfc/*....
Sophia Camila's user avatar
0 votes

Loop over a range of numbers to download with wget

Start multiple downloads in parallel: url="example.com" for i in {001..100} do wget --timestamping --continue --no-verbose "${url}/imageID=$i" & done wait Plese note the &...
Sergey Ponomarev's user avatar
1 vote

bash autocomplete custom script with possiblities from a text file

I figured out a working solution: _run_remote_completion() { local cur_word="${COMP_WORDS[COMP_CWORD]}" local hosts=$(cat ~/data/remote_hosts.txt) COMPREPLY=($(compgen -W "$hosts&...
Blistering Sheep's user avatar
3 votes
Accepted

In which cases outputs of basename "$x" and echo "${x##*/}" differ?

The specification of basename includes the following: SYNOPSIS basename string [suffix] DESCRIPTION The string operand shall be treated as a pathname […]. The string string shall be converted to the ...
Kamil Maciorowski's user avatar
2 votes

How to add a path to PATH variable in linux alpine for the entire machine?

Alpine uses Ash and from the ash(1) man page: Therefore, a user should place commands to be executed only at login time in the .profile file, and commands that are executed for every shell inside the ...
Strahinja Kustudic's user avatar
1 vote

How to run sendmail as another other user?

Why are the above returning different results to executing the commands separately on the command line Because su doesn't actually switch your shell to a different user – it starts a new shell under ...
grawity_u1686's user avatar
1 vote

change bash shortcut keys such as Ctrl-C?

Here's the steps summarized: Go to terminal settings, change Copy from ctrl+shift+C to simply ctrl+c Done. Use ctrl+shift+C in the terminal if you need to abort a program. And that without the need ...
luckydonald's user avatar
0 votes

Custom bash tab completion

Try argrelay for funcs with custom ref data.
uvsmtid's user avatar
  • 143
0 votes

how do I format the wildcard inside the BOOLEAN expression so that it tests for all extensions?

[[ is not a normal command and words in its argument list don't have pathname expansion aka globbing applied to them. [/test with an unquoted wildcard would do the expansion but could uncontrollably ...
dave_thompson_085's user avatar
0 votes

How to Preend or Append File Name to Reflect Number of Pages in PDF using "qpdf" and "perl"

I was unable to find a solution using sed; however, I found a solution using Perl. There were two problems I identified. The first was related to my regex. Namely, the second grouping wasn't working ...
Brian's user avatar
  • 1,045
1 vote

How can I cancel reverse search without losing text typed?

You might want to look into a slightly different behaviour when using reverse search. If you start typing a command, and then press Ctrl+R but don't find the previously typed command, then pressing ...
Rapteon's user avatar
  • 36
0 votes

Error when using apt install in Ubuntu shell of Windows 10

That type of error can occur when the Package Manager's repository cache has not been updated recently. Give sudo apt update a go which should fix it. If not, it could either be a broken apt sources ...
Minecraftchest1's user avatar
2 votes
Accepted

Using sed to edit filepath variable

In your question, you have the following. sed -i "s|${filepath}/${correctfilepath}|g" $Dir/.git/config. In this command, the delimiter | only appears twice. I believe the delimiter needs to ...
David Anderson's user avatar
0 votes
Accepted

Desktop shortcut with a command line argument which contains filename with random numbers

That line seems to work fine directly in a terminal window, but not when i'm trying to launch the desktop shortcut. This is because in a terminal window you interact with a shell that interprets this ...
Kamil Maciorowski's user avatar
1 vote

How can I change values of the `.ini` files via command line? (linux or windows)

This question is 5 years old and despite YAML having mostly replaced INI as the dominant config file format, editing INI files is still something you need to do sometimes – in my case to add or update ...
Frans's user avatar
  • 111
0 votes

How to transfer a file to a remote host using parallel + ssh?

According to a good tradition, I post my own solution. As usual, afterwards, it often turns out to be not simple, but very simple: parallel –tagstring {} -q -a file_ip_addr_hosts.csv\ sshpass -p pass ...
Дмитрий Брыкалов's user avatar
0 votes

SSH from A through B to C, using private key on B

You should copy the private key from B to A (change the name of id_rsa) scp proxy:.ssh/id_rsa ~/.ssh/id_rsa_second Then you can use Host proxy HostName 10.10.10.10 User foo Port 1234 # ...
jeb's user avatar
  • 415
2 votes

How to detect even or odd minutes in bash script

Working with hours or minutes as numbers in bash has a nasty edge case: bash treats numbers with a leading zero as octal, and 08 and 09 are invalid octal numbers: min=09 echo $(( min % 2 == 0 )) bash:...
glenn jackman's user avatar
0 votes
Accepted

exit code segment causes Bash prompt to freak out

You still need to surround each color code with brackets for the same reason, but instead of \[ and \], they have to be \001 \002. The latter are what the Readline library actually expects, while \[ \]...
grawity_u1686's user avatar
0 votes

Alias CMD command from WSL2 shell

On my system the alias below does what you want. First, you should verify how your drive letters are mounted, and that you're able to execute the Windows CMD.EXE from a WSL bash session. I edited /...
philwalk's user avatar
  • 424
3 votes
Accepted

Does bash support variable substitution in return statement?

Has always been like this, because Variable substitution is not done on a per-statement basis. It is not return that expands the variable, much like it's not echo that would expand echo $? – all such ...
grawity_u1686's user avatar
2 votes
Accepted

Provide argument while starting a service using systemctl

Part of systemd's design is that services started from a terminal are subject to exactly the same rules and environment as during system startup (and vice versa) – they can't be directly passed any ...
grawity_u1686's user avatar
0 votes
Accepted

Font size issue with xterms started through icewm's hotkeys

I don't have a solution, other than in general terms originally stated I don't even know what the problem is. But I have developed a work-around, as follows: In icewm startup script I added this line ...
user985675's user avatar
0 votes

Add directory to $PATH if it's not already there

I have these modifications to PATH in my .profile, so it's no good to use the [[ bash-ism. This does the same thing, but should be POSIXly correct: prepend_to_PATH () { local dir for dir ; do ...
Walf's user avatar
  • 459

Top 50 recent answers are included