New answers tagged scripts
0
votes
Correcting #!/bin/env python shebang issue
My /bin and /usr/bin directories point to the same place in Ubuntu:
$ ls -l /bin
lrwxrwxrwx. 1 root root 7 Apr 11 2023 /bin -> usr/bin
Since yours don't, you could make a symbolic link from /bin/...
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 ...
1
vote
Is there an easy way to install Session messenger on Ubuntu/Whonix
Here is the a kind of scripted logic that I've found best working for myself:
1.
sudo curl -so /etc/apt/trusted.gpg.d/oxen.gpg https://deb.oxen.io/pub.gpg
Use force 'trusted' as for some versions ...
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)
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=()...
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 ...
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 "$@&...
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 ...
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/...
Top 50 recent answers are included
Related Tags
scripts × 6717bash × 3523
command-line × 2738
cron × 447
python × 237
startup × 187
server × 173
permissions × 172
ssh × 134
14.04 × 127
sudo × 118
networking × 117
environment-variables × 108
automation × 99
gnome-terminal × 97
sed × 96
text-processing × 95
files × 94
sh × 93
16.04 × 86
apt × 85
directory × 84
nautilus × 83
12.04 × 81
gnome × 81