Questions tagged [scripting]
A script is a sequence of commands or instructions that are executed by an interpreter program rather than compiled into a standalone executable program.
4,566 questions
0
votes
4
answers
66
views
Mount a partition from a script unless it is already mounted
I would like to mount a partition of an external hard drive from a script using
udisksctl mount --block-device /dev/sda1
and in the end of the script I would like to unmount it.
However, it may ...
1
vote
1
answer
39
views
Do I need to define an absolute path to be able to compile the DRM / Panfrost subtree code of JSM on the RockPro64 / Khadas Edge-V / RK3399?
I'm trying to compile the drm-subtree of JSM because I want to enable the panfrost driver on the RockPro64 / KHADAS EDGE-V / RK3399. The code is here:
https://github.com/jsm222/drm-subtree
He improved ...
1
vote
1
answer
39
views
command not running from kde powerdevil
made a simple command to change my power mode to "balanced-performance" (lenovolegion power mode for custom mode), works fine in terminal and running the file, but when listing it as a ...
0
votes
7
answers
2k
views
Is it possible to protect a bash script against a hostile environment?
Bash allows to export read-only variables and functions to the environment.
Also, when a bash script is run, Bash sources the file BASH_ENV was set to, unless invoked with -p.
How do you protect ...
2
votes
1
answer
78
views
socat filter and replace character for modbus ascii
The goal is to get modbus ascii working with a Wallbox from ABL.
So I placed a RS485 to TCP converter in the box, created a pseudo tty for my application and got the wrong frame.
The answer starts ...
0
votes
3
answers
569
views
What are the secure ways to use credentials in bash scripts?
I have a third-party service. Its API and credentials let me scrape service data on my local Linux machine. I want to use this API inside a bash script and launch it via cron, but I don't want to ...
0
votes
0
answers
52
views
Finding and removing duplicate files: Integrating a unix script with an application that opens a file for viewing?
Does anyone know of an open source application or perhaps how to integrate an existing find dupes script with some OS tool (emacs, vim, Finder.app, mc, etc...) to open a file before marking that file ...
0
votes
2
answers
97
views
In a text file, finding and deleting lines including (e.g.) "#', or a word? [duplicate]
I am using Ubuntu Linux and Mageia Linux...
I wish to do the following:
in a text file (sample.txt), find and delete every line comprising the symbol '#' (or '?') or a specific word (e.g. 'mobile')
...
0
votes
1
answer
82
views
Automating the Pause and Resume of a program at regular intervals
My program involving Numerical Mathematics takes a long time to run (12-15 hours). I usually leave it running overnight and check the results the next morning. However, I want to prevent the over-...
0
votes
0
answers
70
views
Why are quotation marks and backslashes not working as expected in variables? [duplicate]
I'm trying to pass a command through to ffmpeg, but I'm struggling to get it to work with spaces in the name.
I've tried this:
filters="-vf subtitles='$filename.$format':force_style=Fontsize=24&...
0
votes
1
answer
395
views
SLURM error and output files with custom variable name
I'd like my log files to be named after a variable. Since this isn't possible:
#SBATCH --output some_software.${var}.out
#SBATCH --error some_software.${var}.err
I came across this work around but ...
-3
votes
1
answer
139
views
Creating in Linux files in GB or MB range by various size by read a file [closed]
In Linux with Bash, there is the File numbers_in_one_line.
In this file there is only one line with several numbers, all separated by spaces.
These numbers are the value in bytes for creating files ...
3
votes
3
answers
452
views
Running a script based on raw events from a specific HID?
bit of a strange issue for you. I have an old 2-in-1 laptop tablet thing that works well enough, except the driver for the touchscreen occasionally crashes, leaving it unusable. I have a simple script ...
1
vote
1
answer
99
views
How can a bash script determine how it was started? [duplicate]
I am running various scripts on Debian 12.X currently with the following bash:
GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu)
I have the following methods/options to execute the script.
...
-3
votes
1
answer
65
views
Rename files, remove the first four signs [duplicate]
There are many files in this format:
IMG_20240717_191421.jpg
IMG_20240620_165358_BURST001_COVER.jpg
IMG_20240624_173513_2.jpg
how can they renamed in Linux in Bash to:
20240717_191421.jpg
...
1
vote
2
answers
257
views
How automatically open a URL after rebooting in a Debian desktop?
How automatically open a URL after rebooting on a Debian desktop?
1- Running the command by terminal:
xdg-open http://homeassistant.local:8123
OK it works and opens the URL above
2- creating any ...
0
votes
0
answers
48
views
HTPC: Xbox Controller binding home button to Script and original function
Situation: I have a HTPC running Nobara linux (flavor of Fedora) and I have an Xbox controller that is connected to it and will wake it from sleep.
Problem: HDMI-CEC is not supported by my hardware. ...
-1
votes
2
answers
97
views
set output into variable from grep from input variable
whats wrong with this bash script:
acme2=$(dig txt @$1 _acme-challenge.$1.de)
acme3=$(echo $acme2 | grep "^_acme") ...
0
votes
1
answer
134
views
I need to run script on remote server which require root access using sshpass and its failing
I need to run script on remote server which require root access using sshpass and its failing with eror script not found. I ran below command.
sshpass -frhelpass ssh user@IP 'echo mypass | sudo -S &...
5
votes
4
answers
614
views
Getting multiple variables from the output of docker exec command in a bash script?
I would like to execute a script on a host machine (script_on_host.sh), which then reaches inside a docker container in order to grab some data using a second script (script_in_container.sh). The data ...
1
vote
1
answer
184
views
Open pdf files by terminal with fzf and fd
with the following command line, which I turned into an alias, I would like to open the pdf files from my terminal.
alias pdfLoad="fd . '$HOME/OneDrive/DBCalibre' -t f -e pdf | fzf | xargs -0 -I ...
1
vote
1
answer
73
views
I have made a startup script but it only can run as an user, not root, how can I make it work?
there are 4 scripts that should be started after reboot as user "appian":
/opt/appian/appian_home/services/bin/start.sh -p Password -s all
/opt/appian/appian_home/data-server/bin/start.sh
/...
0
votes
3
answers
229
views
Parsing data in Bash: adding commas after each string
I am attempting to generate a file that I can append to visudo. The task itself is not too important as I'm just trying to dig a little deeper Bash. My current script looks like this:
#!/bin/bash
...
-4
votes
2
answers
135
views
How to write in Linux in Bash in shellscript a part that can do something like this
How to write in Linux in Bash in shellscript a part that can do something like this
enter a number
must be in a range from 4-999
if not, ask again to enter
enterednumber * 5 * randomnumber [1-9] (...
0
votes
1
answer
223
views
how make it autostart "startx -- -nocursor" in opensuse/openbox?
i want make it automatically to start with no-cursor: startx -- -nocursor this is worked but this is command..i want to autostart to user: kiosk..
(but i don't want to use "unclutter")
i'm ...