All Questions
121 questions
0
votes
0
answers
53
views
Complex logical expression (wrong or as intended?) [duplicate]
I have a 3 part logic (A or B and C). Logically if A is true then true, or if B and C is true then true; But here is the error
if (A or B and C) -> should return true
if [ 1 -eq 1 ] || [ 2 -eq 2 ] ...
2
votes
1
answer
192
views
script arguments in bash
I am working on a a script that need to take two script arguments and use them as variables in the script. I couldn't get this working and unable to find out what I am doing wrong. I see the issue is ...
0
votes
1
answer
36
views
Packages are recognised by normal script but not by service?
my bash script :
#!/bin/bash
. ~/er/erl/activate
kiex use 1.13.4
mix phx.server
i user kerl and kiex to manage my erlang and elixir installations
I am trying to use this script in my service;
[Unit]
...
1
vote
1
answer
547
views
Unix Command (and bash alias) or script to band/unban IP addresses in Fail2ban without having to lookup and specify "jail name"
I am creating a bash alias (or possibly a script) to ban and unban IP addresses with fail2ban on Ubuntu 20.04.
The bash syntax I am using to unban IP address is:
fail2ban-client set YOURJAILNAMEHERE ...
1
vote
1
answer
145
views
problem comparing a bash array value, with a string defined in the script
I'm not really great at scripting but I've been fighting and trying every variation I can find on different threads.
I'm rewriting some old scripts I created for backup/restore of virtualhosts and ...
0
votes
0
answers
17
views
String formatting in bash script won't work [duplicate]
I am working on a self project which is an API server. I am trying to test my api routes using curl command with bash scripts.
The curl commands for post requests are pretty long so I want to use a ...
1
vote
2
answers
322
views
split folder in subfolders keeping parent directories and based on percentage. Using terminal
I have a directory with many subfolders that look like the following, (keep in mind that FA and T1 content is paired and also ..._L, ..._R content). The quantity of folders named here by letters (a,b,...
-1
votes
1
answer
111
views
How can I log everything that appears on the screen? [duplicate]
I want to log everything that appears on the screen. It's supposed to be something like a history file:
I've made something like that but it doesn't work. I can't see what script is doing.
exec > ...
0
votes
0
answers
79
views
Getting email and phone number from website and saving it to a file using bash script?
I have this script to collect information from the website and output them to a text file. It downloads the site then uses grep to extract information. I need to use formatting to output them as I ...
0
votes
0
answers
473
views
My shell script won't run automatically as root using the NOPASSWD argument inside the sudoers file [duplicate]
I want to know why my script won't run as root on Ubuntu 22.04. I want that it does it regardless of the user that executes it, without asking for any kind of authentication. This script should run ...
4
votes
2
answers
12k
views
Creating a bash script to install packages
I'm quite a newbie when it comes to bash. I'm trying to create a script that checks whether a package is installed or not. If not it will install that package. Not sure what I'm doing tbh.
#! /bin/...
0
votes
1
answer
4k
views
Run bash script in cronjob
i'm trying to automate a script using crontab.
I've been searching for some information to help me, but haven't been successful so far.
I created the script with the shebang and full paths.
#!/bin/...
0
votes
1
answer
135
views
why when I execute a select it works and when I execute an update the script blocks?
when I try to execute a query of type update the script hangs and the sql console stays still.
This command executes all queries in the script:
res=$(mysql --defaults-file=conf_file --skip-column-...
1
vote
1
answer
13k
views
Where can I find the meaning of flags in Linux (-rf, -h, -r, -R, -l, etc.) [duplicate]
I am super new to Linux and Bash scripting.
Is there a website where I have an overview for all the different flags and operators?
the Bash scripting cheatsheet is missing quite a few.
Thanks in ...
0
votes
1
answer
585
views
DD Zero Error: No space left on device
Hi currently I am getting a problem with this script when running it on one of our xenial servers to mass wipe a batch of drives in one command.
Firstly all the drives show up in lsblk, so that is not ...