Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

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
17 views

How do I make Debian's greeting look more like Ubuntu's? [migrated]

I want my Debian greeting to show me how many updates are available, like what happens in Ubuntu. Debian greeting: https://i.imgur.com/eJ0UsxU.jpeg Ubuntu greeting: https://i.imgur.com/t0r8nzr.jpeg
default123's user avatar
0 votes
0 answers
57 views

Storing top output to a file continuously

I'm currently using top to gather the most resource intensive processes and sending them to influxdb. Currently, the command is like this: top -bn1 -c -w250 Which basically runs top a single time (-...
Leandro 86's user avatar
0 votes
1 answer
60 views

Unable to query or rm file from an smb mount, but it appears using ls

Problem I have a file that cannot be removed or queried in, but it does appear using ls and does not allow overwriting it. # ls -l -rwxr-xr-x 1 root root 151040 Mar 22 21:55 export.mb -rwxr-xr-x 1 ...
ricekab's user avatar
  • 123
0 votes
0 answers
19 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
35 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
54 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
58 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
21 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
22 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
181 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
77 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
102 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
69 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
170 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
171 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
127 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
56 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
254 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
36 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
29 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
302 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
34 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
73 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
37 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
47 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
200 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
50 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
64 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
416 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
79 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
148 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
42 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
626 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
74 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
301 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
58 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
148 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
204 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
93 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
334 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
  • 174
0 votes
0 answers
370 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
46 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
119 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
705 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
76 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
42 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
48 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
207 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
2 3 4 5
72