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
1
vote
1 answer

avoid zombie processes when using at

I'm using at to schedule a script in a Centos based Docker container. e.g. echo "bash /path/to/script.sh" | at now + 1 minute It mostly works as expected with the exception being that it results in a zombie process every minute. I'm guessing the…
zcourts
  • 149
  • 1
  • 1
  • 7
1
vote
1 answer

shell : warn about or deny command execution with help of an alias

executing iptables -F is very dangerous if your default policy for one or all chains is DROP I would like to use an alias in bashrc like alias iptables -F="echo \ 'WARNING: due to the DROP default rule, flushing all rules would lock you…
MarkHelms
  • 181
  • 5
  • 16
1
vote
0 answers

Debian 8; Run sudo in a screen session at boot without password prompt?

I want to create a startup/boot script that allows me to run a couple of Screen sessions. This I have been able to achieve through creating a script on /etc/init.d/bashfilehere But when I need to run a sudo command, it will prompt me for a password…
Arndroid
  • 111
  • 1
  • 1
1
vote
2 answers

Bash script entrypoint (PID=1) kills `tail` sub process ONLY if a fake trap (which does NOTHING) was there

I am facing a strange behavior in my Bash script, I have this Bash script which is running with PID 1 (it is an entrypoint for Docker container, if you are not familiar with Docker, I assume you can ignore this info). When I run the following…
Mohammed Noureldin
  • 541
  • 1
  • 11
  • 25
1
vote
1 answer

Debian squeeze - Unable to upgrade bash

I'm trying to upgrade bash so its not vulnerable. I tried Sources List Generator for Debian. But libtinfo5 is stopping me from upgrading bash. I could not find older version (due to source list issue) of libtinfo5 to see if could install…
guest
  • 23
  • 3
1
vote
1 answer

Jenkins execute shell return value commands vs file

I was using the Execute shell function in Jenkins with a different set of commands (calling the newman testing application). When one of the test cases was failing through newman, my build was marked as a failure. Previous Execute shell newman run…
abd
  • 113
  • 1
  • 4
1
vote
1 answer

How to write standard output and error to log and from exec

For example, write standard err and standard output to $LOG. but this not print anything to standard output ( on console ) #!/bin/bash LOG=/var/tmp/log #... exec > $LOG 2>&1 my target is to write to $LOG on any standard output and standard err…
shalom
  • 461
  • 13
  • 29
1
vote
1 answer

How to Easily Pass an Environment Variable to an .exe in "Bash on Windows 10"?

I am looking for a way to easily pass an environment variable to a .exe when invoked from the Bash on Windows 10 terminal. It seems that TEST=somevalue example.exe does not work.
1
vote
2 answers

How to get last PID when last process spawned a child and exited?

I start ssh -S mysocket example.com to connect example.com. If my connection hangs, I need to kill that process: ssh -S mysocket example.com -N -L 1234:localhost:1234 & last_pid=$! ...(do something blocker) kill $last_pid But that doesn't work.…
ceremcem
  • 218
  • 1
  • 12
1
vote
1 answer

recognize bash variable inside a text file

I have a file template that will be used by a shell script to generate other files and just change a fill information inside this file template using variables. content of file template.example.log: server name: $HOSTNAME current user: $USER I try…
1
vote
1 answer

nodejs overwritten /usr/bin/which, how to fix?

I have a newly installed centos 7 with only some nodejs projects. Then I found which command is not working properly. # which ls which: illegal option -- - usage: which [-as] program ... # echo…
Reed
  • 287
  • 1
  • 3
  • 10
1
vote
4 answers

find outputs an extra empty line

Im using the find command to find common files between two directories: find "$SOURCE" "$TARGET" -printf "$TARGET%P\n" | sort | uniq -d problem is it always outputs an empty line on the top. Due to that when I try to delete the common files from…
user3360140
  • 281
  • 1
  • 4
  • 14
1
vote
1 answer

Bash - Insert variables into string (command not found)

I try to write a script for get some software's version from many servers. But I get this error message, when i try. bash: Postfix verzio: MariaDB verzio: OS verzio: Java verzio: : command not found bash: postfixverzio: command not found Null…
Crowor
  • 123
  • 2
  • 13
1
vote
2 answers

Rsync files-from trouble

I have strange rsync behaviour. I need to copy all files youngest than 2 days from one folder to another. So i've mixed rsync with files-from argument and find utility in a script to do what i need to do. #!/bin/bash cd /mnt/smb/online/ find .…
Jaels
  • 67
  • 1
  • 11
1
vote
0 answers

How to setup bash environment inside Torque PBS? Why source ~/.bashrc doesn't work?

I have successfully installed Torque PBS on my ubuntu server. Job submission is fine. However there is an annoying thing. I found bash environment is not right inside PBS for example echo 'echo $PATH > ~/res.txt' | qsub and the content of res.txt…
user15964
  • 121
  • 6
1 2 3
99
100