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,565 questions
5
votes
1
answer
318
views
Making `apt-get` read answers from stdin on graphical Ubuntu
This may seem like a question asked, but I have yet to find anything that works and I start suspecting it may be a bug in apt-get…
So, I have a python installer wrapping around apt-get, whose relevant ...
1
vote
0
answers
33
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 ...
2
votes
4
answers
143
views
Is it possible to silence the initial call in xtrace, when BASH_XTRACEFD is set?
#!/usr/bin/env bash
exec {BASH_XTRACEFD}>./xtrace.log
declare -p BASH_XTRACEFD
set -x
{ : "how do you hide this in ./xtrace.log?"; } 2>/dev/null # fail
# { :; } "${BASH_XTRACEFD:-...
1
vote
1
answer
35
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 ...
3
votes
7
answers
977
views
How to list only the last name.partXXX.rar file?
In Linux in a folder, without subfolders, there are many files like this scheme.
I list them with ls -1.
1yBWVnZCx8CoPrGIG.part01.rar
1yBWVnZCx8CoPrGIG.part02.rar
1yBWVnZCx8CoPrGIG.part03.rar
...
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 ...
9
votes
7
answers
1k
views
Check if multiple files exist on a remote server
I am writing a script that locates a special type of file on my system and i want to check if those files are also present on a remote machine.
So to test a single file I use:
ssh -T user@host [[ -f /...
2
votes
1
answer
71
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 ...
1
vote
1
answer
99
views
Process some Folders and format the output
In Linux there are some Folders.
I want to process each of this Folders with the program myprogramm.
I get a list with ls -1 or much better, sure only Folders with:
find . -maxdepth 1 -type d -printf '...
0
votes
3
answers
399
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
1
answer
119
views
How to match exact string? [duplicate]
I tried this
grep -rn "application_config_project" .
I got many
application_config_project_name = f"{app_acronym}-application-config"
github_application_config_repo = ...
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
5
answers
210
views
Rename a set of files according to a specific scheme, with rename back option
In Linux in a directory there are files, ls -1 shows me this output :
file1.1-rvr
file1.2-rvr
file1.3
file1.4-rvr
file1.5
file1.6-rvr
file2.1
file2.2
file3.1
file3.10
file3.2-rvr
file3.3-rvr
file3.4
...
0
votes
2
answers
92
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')
...
1
vote
2
answers
83
views
How to specify ELF shared objects in `LD_PRELOAD` if their path contains a space character?
Paths to ELF shared objects in LD_PRELOAD cannot contain spaces, as space is one of the two list separators, and it cannot be escaped:
LD_PRELOAD
A list of additional, user-specified, ELF shared ...