Questions tagged [bash]

Bash is the Bourne Again SHell, the successor to the classic Unix sh (shell).

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

Kubernetes (CRI-O) cannot ping to any host

Cannot ping to any host from kubenetes pod. Needed functionality: Ping between 2 kubernetes pods Expected result: Successful ping between 2 pods. Current output: pod/kube-server-rtt-3 created pod/kube-...
ArneDH's user avatar
  • 1
0 votes
0 answers
28 views

I'm getting on gitbash a warning WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! for github [migrated]

When I try to clone a git repository in gitbash on Windows I get following error: $ ssh -T [email protected] @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST ...
Asterios Raptis's user avatar
0 votes
0 answers
31 views

How to extract umask value from new instance bash shell with single command?

I can extract umask value from new instance bash shell with this method : [ansible@rhel8 ~]$ umask 0027 [ansible@rhel8 ~]$ bash [ansible@rhel8 ~]$ umask 0002 [ansible@rhel8 ~]$ But for me this is ...
M. Fachrizal Utama's user avatar
0 votes
1 answer
43 views

Check if package exists in repository that is not on my sources.list?

TL;DR: How can I check if a package exists in a repository that's not on my sources.list? What I want: Most answers I'm finding assume the repo I need to check is already in my /etc/apt/sources.list. ...
ᴍᴇʜᴏᴠ's user avatar
0 votes
1 answer
47 views

cd command not recognized by a systemd service script

Hi run Debian OS and I have a shell script that runs sphinx search. The script runs fine if I run it from terminal as below: sh /home/myuser/sphinx/run_sphinx.sh Here is the content of run_sphinx.sh #...
Dev Dev's user avatar
  • 31
1 vote
0 answers
15 views

Run a script when a user is created by SSSD

Basic setup: I'm running an Ubuntu VM which is joined to MS AD. SSSD handles user creation when people log in using their AD credentials. The only login method for the users is via xrdp. When a new ...
equinsu_ocha's user avatar
0 votes
2 answers
17 views

Replace text with sequence of numbers

I have 2250 metadata files that need to have a unique number starting at 0 going to 2249, as the line below. "name": "KF # RENUMBER", I've used the perl command (perl -pi -w -e 's/...
John Fallon's user avatar
0 votes
2 answers
98 views

use wget in bash script - how to get downloaded file name? (using content-disposition)

i am using wget to download some file in a bash script. i need to use it like this: wget -t 20 --content-disposition $link the problem here is, that i cannot specify the output file since it comes ...
pcace's user avatar
  • 101
0 votes
1 answer
48 views

getopts does not find missing arguments on multiple options

Bash 5.1.16 The following code doesn't work for me: optstring=":l:s:vh" while getopts ${optstring} flag; do case ${flag} in (l) listsfile=${OPTARG};; (s) sourcedir=/${OPTARG};; ...
Dominik's user avatar
  • 11
0 votes
0 answers
92 views

sshpass/rsync fails when not redirecting stdout etc

I am having a weird issue and I just can't seem to find the cause and a solution. I am on win11/cygwin (sshpass 1.06,rsync 3.2.7) I call: /usr/bin/sshpass -p $sshpasswd /usr/bin/rsync --dry-run -...
Dominik's user avatar
  • 11
0 votes
1 answer
41 views

keyboard combination to search forward in bash history

Pressing ctrl-R allows me to search thru command line history Pressing ctrl-R allows me to go back in command history matches What is the keyboard shortcut to jump forward in command history matches? ...
opensas's user avatar
  • 1,191
0 votes
1 answer
110 views

How to convert text file from BASH to HTML?

I already extract some text from bash using command "systemctl status ddos.service" bellow : But, when I generate report in html for text that I extract above, it show all text in one line, ...
M. Fachrizal Utama's user avatar
0 votes
0 answers
122 views

Running ssh-add in bash with both the key and passphrase as arguments

I am trying to run ssh-add by bash script on Alma9 server with restrictions. The RSA key 4096 is on an SMB share so the file has broken permissions and the key is protected by a passphrase. As the ...
Richard E's user avatar
  • 131
0 votes
0 answers
115 views

Remove bash permissions for a user

I have to create a user that uses /bin/sh as initial shell. This is something I have already done but, I need that this user cannot access bash under any circumstance. After searching on the internet ...
tndb's user avatar
  • 1
0 votes
0 answers
38 views

How to establish VPN connection with two factor authentication from CLI

A VPN connection have to be established on demand from a bash script. GUI needed to enter two factor auth code. If you'll try to execute in terminal: VPN_NAME=$(nmcli con|grep "VPN"|awk '{...
Vasin Yuriy's user avatar
1 vote
1 answer
213 views

HEREDOC in Dockerfile produces no output

I have this command that I am trying to run in a Dockerfile and it is producing no output to the file: FROM alpine:3.19 as base RUN <<-EOF > /root/.npmrc registry=https://\${...
Christian Bongiorno's user avatar
0 votes
0 answers
34 views

Dynamically Set GitHub Actions Secrets on Docker Container Build/Run Command with bash/shell

I'm in the early stages of building an automated pipeline. Still in the exploring phase. Right now, I'm struggling with setting the environment variables for the container I'm going to run my app and ...
Jorge Mauricio's user avatar
1 vote
0 answers
63 views

Executing a list of commands on distinct lines with bash -c?

I pass a list of commands to a bash script through an environment variable as shown in the example below: CMDS=' date > date.txt cat date.txt date | rev ' script What is the correct ...
chmike's user avatar
  • 448
0 votes
1 answer
25 views

Variable substitution not working in CGI script

I am trying to make a CGI script that takes the name and email from a form, decodes the QUERY_STRING variable into the two values, and then does stuff with them ( for now I just decoded the name an I ...
velici alex's user avatar
1 vote
2 answers
225 views

DHCP starting before network is ready

I am having a problem with my DHCP server. When it restarts the isc-dhcp-server does not get ready because the network (it uses NetworkManager) is not ready. I put a sleep command in the isc-dhcp-...
Anderson Silvestre's user avatar
0 votes
0 answers
27 views

-CGI script not getting executed

0 I'm trying to make a simple form where you can introduce you're name and upon hitting the submit button you get redirected to a page where it says "Hello name_that_was_submited!". I did ...
velici alex's user avatar
0 votes
0 answers
69 views

cd: permission denied: /a/b/c/d, but can get to d by CDing one directory at a time

I am occasionally running into this weird situation where I when I try to CD into a particular directory, it gives me a permission denied error. But when I CD into it one directory at time (i.e., CD /...
SAS2Python's user avatar
0 votes
1 answer
29 views

argument to pgrep from cmdline returns 2 PID's and argument from global variable value returns 1 PID

1.first case(processName as argument from cmd i.e java) command from cmd with arguments : ./a.sh getProcessId contains java code: getProcessId(){ matchType=$1 #defaulting matchArg to x i.e exact ...
Nitin Alety's user avatar
1 vote
0 answers
44 views

crontab -> shellscript -> docker -> redirect output to localfile

I am currently switching from rsync to a borg based backup. Everything is working, except getting the output of borg to my logfile. My setup is as follows: I am trying to do everything in docker to ...
peez80's user avatar
  • 191
0 votes
1 answer
173 views

pgrep -f from shell script is returning 2 pid instead of 1

code : function main { [ -z "$@" ] && { getProcessId "$@" } || "$@" } getProcessId(){ matchType=$1 #defaulting matchArg to x i.e exact match matchArg=x ...
Nitin Alety's user avatar
0 votes
1 answer
48 views

sftp download without keyring prompt - without change of .bashrc

For a bash install script, I need to download files with sftp. When doing so, a gnome keyring prompt will open. This can be avoided by some changes in .bashrc or so. But as my script should run on any ...
herrdeh's user avatar
0 votes
1 answer
58 views

How can I log when the postfix (for an incoming mail server) enters the stressed condition?

I have a server that I use only for incoming emails it uses Postfix as MTA. I want the postfix logs to indicate when (and if) the MTA enters the stressed mode. I thought about writing a custom bash ...
SUNITA GUPTA's user avatar
0 votes
3 answers
335 views

Shell script capturing values from output of command

From a shell script, I run a ping command: ping -c4 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=58 time=34.2 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=58 ...
Simon Kepp Nielsen 's user avatar
0 votes
0 answers
74 views

not able to send mail with attachment from linux ubuntu : 20.04 by using email mailutils (sendmail keyword)

code : subject="Service resilience service status" body="Service is down" from="[email protected]" to="[email protected]" attachment="/home/ubuntu/...
Nitin Alety's user avatar
1 vote
1 answer
143 views

not able to send mails from linux ubuntu : 20.04 by using email mailutils (sendmail or mail keyword)

code : subject="mail subject" body="Hello World" from="[email protected]" to="[email protected]" echo -e "Subject:${subject}\n${body}" | sendmail -f "...
Nitin Alety's user avatar
0 votes
0 answers
35 views

_curses.error: cbreak() returned ERR when running jenkins

I'm running pg_activity through a bash script to simulate that pg_activity that can launch correctly without any issues. Below is my script #!/usr/bin/bash /soft/python3.7/bin/pg_activity <<...
Andy K's user avatar
  • 119
0 votes
1 answer
536 views

How to check if a process is running or blocked on lock or I/O?

There are 2 instances of a script reported by ps. How can I see in the command line if one of those (and which) is blocked on either I/O or on a file lock?
Jim's user avatar
  • 109
-3 votes
1 answer
70 views

I want to make a sell script to input text into a command in debian

I am sorry if I am having trouble explaining, here is my issue, I want to make a basic shell bash script say x.sh and I want to run command change htpasswd -b -c /etc/squid/squid_passwd root pass ...
Nova's user avatar
  • 5
0 votes
0 answers
261 views

Bash Script - How to escape JWT in curl correctly

Im trying to just execute some curl commands against an API from within a bash script. I wrote it on Mac OS and the thing ran without issues. I started executing it on linux and found some strange ...
embedded's user avatar
  • 476
0 votes
0 answers
52 views

list only one Process by name in htop (even when it restarts?)

i am trying to get htop to show me one process. this is a programm i wrote wich comes up from time to time (so it always has another pid). what i am trying is something like that: htop -p $(pgrep ...
pcace's user avatar
  • 101
0 votes
1 answer
121 views

How to start a sudo-privilage program with screen so that I can re-attach to it later?

Here's the problem I face: I have a program that must run as root. I want that to run in a screen, but here's a twist: for admin reasons, I want to be able to re-attach to it. I'm writing a dirty and ...
CptZsolt's user avatar
0 votes
0 answers
40 views

Bash script error when trying to create a snapshot

I am trying to create a snapshot using Bash script as below but error occurred. Environment: FreeBSD, Version: 13.2, Script: Bash #!/usr/local/bin/bash name="17102023_1234" zfs snapshot data/...
Charles Kwon's user avatar
1 vote
0 answers
169 views

Set GitHub secret keys in bulk – sh file

I’m in the initial stages of building a simple automated deploy pipeline. One of the steps I’d like to implement would be setting the GitHub Actions secrets in bulk, since I have many of them in my ...
Jorge Mauricio's user avatar
0 votes
1 answer
80 views

get user with crontab root

I run myscript.sh scheduled in the root crontab and I need it to detect the non-root user (with which the system starts). I have tried these variants: local_user=${who -m | awk '{print $1;}'} ...
acgbox's user avatar
  • 398
0 votes
1 answer
279 views

is /etc/sudoers writable or not

The default permission in /etc/sudoers file is readonly for root and group root as in picture is obvious : So when you open it with any test editor it can't be written and give error read only. now ...
Salar's user avatar
  • 164
0 votes
0 answers
329 views

Systemd service executing a script with error handling

I have the following issue: I created a systemd service which executes a script. This script contains several commands including psql commands which queries a database and stores the outcome into ...
NeG's user avatar
  • 1
0 votes
1 answer
43 views

copy many files with big sizes over rsync

I have database server on AWS and the backup of databases are over 1000 files with sizes can reach 5GB, I am using a script to copy the backup to my data center using rsync, but the copy is slow, I ...
Khaled Hussein's user avatar
0 votes
1 answer
103 views

Bash script : Print all lines between two pattern in variables with slashes

I have a directory that looks like so : /path/to/files/data-file.1 /path/to/files/data-file.2 /path/to/files/data-file.3 /path/to/files/data-file.4 /path/to/files/data-file.5 /path/to/files/data-file....
Ror's user avatar
  • 343
2 votes
1 answer
638 views

Blocking traffic from specific countries. How to kill existing connection?

Using Linux Debian Bookworm. Problem I want to block all incoming connections to my server coming from specific countries. Edit As someone pointed out in the comments, I really shouldn't be doing this ...
Zippy1970's user avatar
  • 279
0 votes
1 answer
70 views

su command not set BASH_VERSION value and not load profile

I have a Ubuntu 20.04 LTS server version and have a strange problem creating a new user and use it in the shell from a ssh connection. The steps to reproduce it: Use he root account to create new ...
e-info128's user avatar
  • 173
0 votes
0 answers
41 views

AWS CodeDeploy - Must be connected to a terminal

I have a CICD Bitbucket pipeline that runs and tries to execute a deployment script. appspec.yml version: 0.0 os: linux files: - source: scripts/osgi-deploy.sh destination: /home/...
Richard's user avatar
  • 145
0 votes
0 answers
45 views

sanitize folder names before creation

How prevent the injection when creating folders with user supplied paths in a unix like system? Ideally subfolders can be created only in selected or working folder. Although the creation of folder in ...
Serge's user avatar
  • 101
0 votes
2 answers
203 views

Bash parameter substitution (baparmsub?) Isnt working

[ using bash -cx 'a="_IN_workstation"; b=${a/[a-zA-Z]*[a-zA-Z]/_};echo x.$b.x' does partially work but the lack of parenthesis will skew the match. So this points to the parenthesis ...
ArrowInTree's user avatar
1 vote
1 answer
101 views

Bash has problems with cmdline nft cmd vs script

linux mint. uname -r yields 5.15.0-56. dpkg-query -l bash yields 5.1.6ubuntu1. My script shows this problematic output when bash -x script invoked: attrib =' '\''{type nat hook prerouting priority ...
ArrowInTree's user avatar
0 votes
0 answers
78 views

Is there any cli to detect directory changes between bash script runs?

For example I have this command generate-and-deploy-new-version ./site-directory and I want to run it only if content of the ./site-directory was changed. if checkchanges "./site-directory" ...
ais's user avatar
  • 101

1
2 3 4 5
72