New answers tagged scripts
0
votes
How to bind mouse buttons to keys?
For me, and my Logitech G402 mouse, the Piper mouse configuration tool worked perfectly!
https://github.com/libratbag/piper
installable via apt
sudo apt install piper
- 101
0
votes
Script to open terminal and show the output of the running commands
This command also works perfectly :
xfce4-terminal -x /usr/bin/expect -c 'spawn /usr/bin/bash ; expect "$ " ; send "update" ; interact ; exit'
You need to check if expect is in ...
- 275
1
vote
Accepted
My terminal tabs running scripts are being automatically closed
This answer to a similar question offers three methods to keep gnome-terminal open after your scripts exit.
- 141
0
votes
Syntax error: "(" unexpected
The answer is similar to answer already posted, but giving an explanantion.
I thing you are running this script sh code.sh. This means you are using sh to run the script, but the first line (#!/bin/...
- 183
0
votes
Using redirection to write a command using a file
Try this:
theip=$(cat /etc/scripts/current-ipaddress | awk '/^eth0:/{flag = 1; next} flag == 1 && / inet / {print $2} /^[^ ]/ {flag=0}')
Explanations:
cat filename: print the file content
...
- 237
0
votes
Ubuntu 20.04 @reboot cronjob doens't run script
Problem solved, this is what i did to solve my problem.
I ran the script manually using bash apilibro, so i notice that yarn wasn't present in my environment variables, i just added as @Artur Medim ...
4
votes
Accepted
Startup script not executing
Your commands to manipulate the touchpad's settings require an X server user session already running which is not the case during boot nor for the root user on Ubuntu.
The best way to run such a ...
- 18.4k
0
votes
Startup script not executing
You execute the command as the root user, not your regular user account. Tis probably has the effect that the configuration is performed for the root-user. Try to use your touchpad as the root user ...
- 319
0
votes
Ubuntu 20.04 @reboot cronjob doens't run script
1st way,
i think you can use the command to check out log of crond
tail -f /var/log/cron.log
the output here might be give you some info.
if there is no cron.log, use this command and restart the ...
- 1
1
vote
Accepted
How to test if .desktop file is working?
You can test a .desktop-file by executing it via double-click. If the .desktop-file does not work you have to troubleshoot a bit. First you'd check if the script works as expected in a terminal.
The ...
- 13.9k
0
votes
how to quick input current date & time with a quick word?
You may use lua to extend quickphrase for fcitx/fcitx5.
The lua relevant API is based on old Google Pinyin lua on Windows. You may refer to this doc to see what extra API are available: https://fcitx....
- 156
4
votes
Accepted
Passing "flag" Arguments to Systemd Services
The conversion of - to / is for allowing paths in the template argument and other parts of the unit name. This is covered in man systemd.unit, section "String Escaping for Inclusion in Unit Names&...
- 188k
0
votes
Accepted
Fix error: Cannot autolaunch D-Bus without X11 $DISPLAY on script to change wallpaper using systemd
Answer
This is not possible using systemd. Basically the DISPLAY variable will not be accessible to it; variables go from parent to child processes, not the other way around.
A possible way of making ...
- 951
0
votes
CPU architecture scanning using bash
On some distros the -i might return unknown (e.g Arch, Manjaro) some reason. So the uname --machine is what should be used. It will output x86_64, and it works universally on all distros I have ...
1
vote
Accepted
How to batch rename files (images) recursively based on CSV file
From the parent directory, you can do:
while IFS=, read -r orig new; do find -type f -name "$orig" -execdir echo mv -n -- {} "$new" \; ; done < files.csv
echo is for dry-run ......
- 18.4k
14
votes
Accepted
Syntax error: "(" unexpected
If needed, make the script executable first by running:
chmod +x myfilename.sh
Then, run the script like this:
./myfilename.sh
Or run it explicitly with bash like this:
bash myfilename.sh
(These ...
- 14.2k
0
votes
Accepted
whats wrong with this cron job?
I added a link to the script in /bin where root can use it. That alone did not work, after editing ctrontab -e
every way I could imagine, I deleted my entry there, and edited the file /etc/crontab to ...
- 14.1k
0
votes
$PATH - No such file or directory (but all files and directories exist)
to add a path to your $PATH variable, add this to your .bashrc file
export PATH=$PATH:/path/to/your/command
To reload your .bashrc file, run exec bash
- 61
0
votes
How to rename multiple files and folders recursively that include * and other symbols not valid for filenames/folders?
You can use the rename command with recursive shell globbing from the parent directory containing all your directories and files that you need to be renamed like so:
shopt -s globstar
rename -n 'y/\*/...
- 18.4k
0
votes
STDOUT not performing as expected in script
Thanks everyone for your help. It is hugely valued. This one may remain a mystery, as all suggestions don't result in a logfile output.
The only way I could achieve a logfile is to launch the file ...
- 33
1
vote
Is it possible to create a series of text files with names based on a pattern and fill them with X characters from /dev/urandom?
In bash, you can use a for ...; do ...; done loop with braces expansion(e.g. {00..10} or {000..999} etc.) with head -c 256 to read 256 bytes(IMO more than that is an over-kill for your purpose and a ...
- 18.4k
2
votes
Is it possible to create a series of text files with names based on a pattern and fill them with X characters from /dev/urandom?
One option would be to pipe data to the split utility
NAME
split - split a file into pieces
SYNOPSIS
split [OPTION]... [FILE [PREFIX]]
DESCRIPTION
Output pieces of FILE to ...
- 127k
Top 50 recent answers are included
Related Tags
scripts × 6549bash × 3421
command-line × 2652
cron × 432
python × 230
startup × 182
permissions × 166
server × 160
ssh × 128
14.04 × 126
sudo × 117
networking × 110
environment-variables × 103
automation × 95
files × 94
sed × 93
gnome-terminal × 92
text-processing × 92
sh × 91
16.04 × 86
apt × 82
directory × 82
12.04 × 81
nautilus × 81
gnome × 79