Questions tagged [bash]

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

bash is the Bourne Again SHell, the successor to the classic Unix Bourne shell (sh). It's the default shell on many Linux distributions, including RedHat, CentOS, Debian, and Ubuntu.

The premier online guide is the BashGuide.

3527 questions
2
votes
1 answer

Why is the displayed name in bash different from the one in /etc/passwd?

I remotely SSH login as root (using PUTTY), The bash shell prompt becomes: [root@yukiko /]# When I entered: getent passwd The first line I see is this one: root:x:0:0:root:/root:/bin/bash Shouldn't the bash shell prompt look like this? (which…
bobo
  • 599
  • 2
  • 8
  • 24
2
votes
2 answers

Curl Command Send Asynchronous Request

I using this curl request for sending data to API : curl --location --request POST 'MY_IP' \ --header 'Content-Type: text/plain' \ --data-raw ' [{ "event_id": "123", }] ' I want to check the API performance by sending request asynchronously…
Martin
  • 21
  • 1
  • 2
2
votes
1 answer

Not able to access groovy variable inside shell script in JenkinsFile

def NAMESPACE = "Dev" def BODY= sh( script:'''body=$(cat <<-EOF { "name": "${NAMESPACE}", "type": "regularwebapp" } EOF ) (echo $body)''', returnStdout: true ).trim() The above doesnt work, output is as follows: { "name": "", …
Sidd
  • 21
  • 1
  • 2
2
votes
1 answer

Ansible Search for parent-directory-names of files

I'm trying to get the parent directory Name of files identified by a pattern. base/tool1/sub/test.log base/tool2/abc/values.log base/tool3/sub/test.log I want to get every directory absolute path, where test.log is to find. so base/tool1/sub/ and…
Ralf157
  • 21
  • 2
2
votes
1 answer

How do I find files and directories not owned by a given user?

I have a set of files within a directory owned by 'alfred'. From a quick inspection, most of the files within are also owned by 'alfred'. I'd like to change ownership of the folder and everything owned by 'alfred' to be owned by 'betty'. However,…
Borea Deitz
  • 202
  • 1
  • 10
2
votes
2 answers

Can't access instance after setting up iptables rules

I'm trying to setup some rules to block all ports except 21 and 22 on TCP (SSH and FTP). But when I try to run this script I get locked out of my instance and can't access it. This is the script: # Flush the FW Rules iptables -F iptables -X #…
mj01100011
  • 23
  • 3
2
votes
1 answer

Cron Permission Denied

good day, I have a bash script in my home directory that works properly from the command line (file structure is default media temple DV. < noted for certain permission issues) but receive this error from cron: "/home/myFile.sh: line 2:…
user32372
2
votes
1 answer

ssh remote command parsing gone wrong

I am trying to execute a single remote command via ssh for debugging setup. This does not execute the correct command (I cannot see the output but it seems the PID is missing to gdbserver): ssh -t admin@myhost.com "ps -A | grep myprocess | awk…
Rolle
  • 123
  • 4
2
votes
1 answer

Remote command has different umask

ssh user@host "umask" gives 0174 ssh user@host and the umask from server shell gives 0002 Could you please explain how can it happen? UPD: Actually, it was /etc/passwd overriding umask.
2
votes
2 answers

make ssh remember host's username

I connect to many servers daily. my ssh config default username is "admin" but servers comes from different environnements and username can changes. sometimes it will be "ec2-user" or "exploitation" or "something-else" ... Is there a way SSH…
exeral
  • 1,787
  • 11
  • 21
2
votes
1 answer

linux bash script - how to check if variable has changed?

I write a small bash script who check the latest stable Nextcloud server version available and notify me I would like the script notify me with "notify-send" command only if the server version number change. My simple script : #!/bin/bash # The…
Maxime
  • 69
  • 7
2
votes
1 answer

Yum: Can a package have a alias or short name?

I have installed yum package "mysql" previously using : yum install mysql However when I try and list installed packages using filter: yum list install *mysql" It shows nothing but when I list installed packages without I can see package names…
Rubans
  • 133
  • 5
2
votes
2 answers

How does deleting the oldest ZFS snapshot not break the flow of data?

I'm not new to ZFS. I've been using it a couple of years but I've only just started making snapshots and I've created a cronjob and script to take a daily snapshot of a few of my datasets, which all reside under the same pool. I was looking for a…
bitofagoob
  • 133
  • 6
2
votes
3 answers

How to deal with whitespaces in scripts

I would like to find certain files on my external disc and delete those. I created following script (to test I only use ls $i to check the output) for i in `find /media/My\ Book/ -name "OP_CACHE.IDX" -print`; do ls $i; done The problem is, that…
2
votes
4 answers

How to post logs to Cloudwatch with CLI?

Im tring to create a bash script that checks the status of the website, Im using this command: This one to create the logstream aws logs create-log-stream --log-group-name "WebsiteStatusMessage" --log-stream-name $timestamp This other one to post…