New answers tagged

0 votes

How to write a bash script from two commands (Find and replace a text string in all files recursively in current directory)

This site is not a script-writing site, but help to anyone on planet Earth is a strong motive in this community (no discrimination against beings from other planets :-) thogh). That said, take the ...
Raffa's user avatar
  • 31.9k
1 vote

Is there an easy way to install Session messenger on Ubuntu/Whonix

Here is the a kind of scripted logic, I've found best working for myself: Step 1: sudo curl -so /etc/apt/trusted.gpg.d/oxen.gpg https://deb.oxen.io/pub.gpg Step 2: echo "deb [trusted=yes] https:/...
Igor's user avatar
  • 45
0 votes

How to completely restart script from inside the script itself

Late & noob, but I had to use absolute path to make mine work: exec "/usr/local/bin/audio-device-switch.sh" (exec "$ScriptLoc" didn't work for me)
taps's user avatar
  • 1
1 vote

Backporting: Does anyone have a function to mimic bash 4 associative array?

I wrote the following and it works to simplest of my needs: #!/bin/bash declare -a __MIMIC_ASSOC_ARRAY__VARNAME=() declare -a __MIMIC_ASSOC_ARRAY__VARKEY=() declare -a __MIMIC_ASSOC_ARRAY__VARVALUE=()...
rusty's user avatar
  • 16.3k
0 votes

File removal on power off

Here is a much simpler version of @rusty's answer. I will use the official systemd-tmpfiles mechanism. Note that just like that answer, my answer removes things at power on not power off. Just paste ...
Daniel T's user avatar
  • 4,574
1 vote

Run a script after every grub-update

update-grub is a small shell-script that just calls another shell-script grub-mkcnfig withe some options: $ cat /sbin/update-grub #!/bin/sh set -e exec grub-mkconfig -o /boot/grub/grub.cfg "$@&...
mook765's user avatar
  • 15.8k
2 votes

Run a script after every grub-update

All you need to do is add your script file to /etc/grub.d and make it executable. They are executed in shell expansion order. For example, add this as /etc/grub.d/90_my_script #!/bin/bash echo this is ...
brianc's user avatar
  • 21
2 votes
Accepted

Download and Remove the files from SFTP server

sftp usually accepts commands interactively. The download and the remove are separate. We can make bash automate that: sshpass -p password123 sftp [email protected] << EOF get /Complete2/...
Daniel T's user avatar
  • 4,574

Top 50 recent answers are included