Bash is a free shell for Unix-like operating systems, from the GNU Project

learn more… | top users | synonyms

0
votes
1answer
6 views

i need to pass a string of an output file to a variable so as i can use it globally all over my script

sample output RETENTION_INTERVAL ------------------ 10080 I need to pass the numeric value "10080" from the output file to a variable .The condition should validate value and ...
0
votes
0answers
3 views

Strange bash error: “error importing function definition for `BASH_FUNC_module'”

Sample script: #!/usr/bin/env bash echo "abc" Output from Bash version 4.1.2(1)-release: $ ./a.bash bash: BASH_FUNC_module(): line 0: syntax error near unexpected token `)' bash: ...
0
votes
0answers
15 views

Close terminal if exit code is not 0 for command after login

For security, I'm trying to set up double authentication for a CentOS server. The way it works is you log into a user with SSH keys then once you log in it executes su to change to the root user, ...
2
votes
2answers
17 views

list & sort subfolders by number of items

I'm trying to write a bash script to list & sort subfolders by number of items. Here's what I have: find * | wc -l works to return count of items. And for f in *; do echo "$f"; find "$f" | wc ...
0
votes
1answer
10 views

Bash ignore commands, other options not working

Prefacing a command with a space is not making bash not save it to history. This is in my .bash_profile HISTCONTROL=ignoreboth What else do I need?
0
votes
0answers
8 views

Looking for a Batch script or Jenkins plugin

I have a two Jenkins jobs. First one do the build and copy the special version number in a property file. In my second Jenkins job, I read that property file in parameterized variable setup and ...
41
votes
6answers
40k views

How to configure PuTTY so that Home/End/PgUp/PgDn work properly in bash?

The keys Home, End, PageUp, PageDown all type a ~ in my bash session instead of moving the cursor / view around. Why does this happen and which settings do I need to change? GNU bash, version ...
0
votes
0answers
11 views

Bash script monitor file modification after its closed

It has already been asked here and I have found the solution for the first part of my question. So for the moment I have a bash script (script1) where I evaluate the sha1sum of a specific file ...
0
votes
0answers
10 views

midnight commander subshell - sharing a history file with the shell mc was started from

I am looking for a way to make midnight commander share its subshell history with the parent shell. To be more specific, when I start mc, open its subshell using Control+o and subsequently invoke a ...
4
votes
0answers
26 views

Tar using progress bar and handling multi-volumes

I'm trying to create a tar of a large LVM volume onto multiple external drives. That part is solved. Now, because it is a LONG process, I'd like a progress bar. From the excellent articles here, ...
1
vote
1answer
26 views

What is SSH_AUTH_SOCK?

When I export in my terminal I see: declare -x Apple_PubSub_Socket_Render="/private/tmp/com.apple.launchd.zTF2WfVZJa/Render" declare -x ...
1
vote
0answers
19 views

Pacmd dynamic range compression Ubuntu 14.04

I used the answer at the link below to successfully set Dynamic Range Compression on my Ubuntu media box running Ubuntu 14.04 (SteamOS session, so no Ubuntu desktop session available). Realtime sound ...
0
votes
0answers
29 views

weird behaviour with forever, bash, apache and php

I'm running some node.js scripts with forever. I started them as www-data user (i.e. via ssh logging as www-data@server and typing forever start myapp.js, etc.). Ok, everything goes like a charm; my ...
0
votes
1answer
11 views

How can I configure the cancel button of dialog box bash?

dialog --backtitle "Dialog - Form sample" \ --form " Form Test - use [up] [down] to select input field " 21 70 18 \ "Network-ID:" 2 2 "" 2 15 20 0\ "Subnet Mask:" 4 2 "" 4 15 20 0\ thank you for ...
0
votes
1answer
19 views

How can I control specific traffic like UDP traffic with iptables on ubuntu?

If for example I would like to send just the UDP traffic to an IP-address, is it possible to do this with iptables ?
1
vote
1answer
22 views

Complex alias command

I am trying to create a complex alias. I have a lot of servers I have to ssh to and writing the entire command is quite annoying some times. I created aliases for every machine: alias ...
0
votes
2answers
3k views

“Reset” colors of terminal after ssh exit/logout

When I ssh into a remote server, I like the colors of the terminal to change. I use setterm on my remote ~/.bashrc file to get this done. However, when I exit, the terminal colors are not reset to the ...
0
votes
3answers
45 views

What does this use of the echo shell command do?

I found echo -n $'\e]0;Hello World\a' in a shell script that's part of a code base I'm working on. What exactly does that do? It certainly doesn't echo anything visible. Note, I'm using Ubuntu ...
0
votes
1answer
18 views

If else case for established connection

How do I modify this test such that if the number of connections to port 1234 is greater than 10 then to execute a command (like an echo something)? [[ $(netstat -tan | awk '/:1234/ && ...
0
votes
1answer
33 views

How to git pull without asking password?

I have a problem for make a auto pull for a git repository. I explain my situation : i have 2 sever on linux (Debian), one for the repos (dev01) and another one for make documentation with doxygen ...
0
votes
0answers
14 views

how to bring network up at boot time in ubuntu 14.0.4

I am write one shell script which execute on every boot, Script is as below. service lsyncd stop /etc/init.d/networking force-reload ifconfig eth0 > /home/sachin/status.txt old="0.0.0.0"; ...
0
votes
1answer
11 views

'hhighlighter' wrapper script saying command not found

I have gotten the wrapper script 'hhighlighter' from https://github.com/paoloantinori/hhighlighter which colors anything you want in stdout. I followed the instructions about installing ack-grep, ...
0
votes
1answer
35 views

Ubuntu nested bash shell

Thanks for any help. I'm helping configure a machine to log keystrokes using /usr/bin/script function. For each session, a log file is created that includes the POSIX time. $PS1 is changed to reflect ...
3
votes
5answers
125 views

How to match everything from after the last YAML delimiter onwards

I normally use grep to search for a pattern in a string. However in this particular instance I have to identify a YAML header, also, it ends with a triple dash. My test.info file has the following ...
2
votes
3answers
2k views

Count of files in each sub-directories

I would like a BASH command to list just the count of files in each subdirectory of a directory. E.g. in directory /tmp there are dir1, dir2, ... I'd like to see : `dir1` : x files `dir2` : x ...
13
votes
3answers
7k views

Check number of pending security updates in Ubuntu

Let me start by saying I have been forbidden to enable automatic updates on our Ubuntu servers, for both security and regular packages. When I log into any of my four Ubuntu servers, the welcome ...
0
votes
0answers
13 views

adding a number variable with a string [migrated]

I'm asking the user to enter a number and if the number is greater than 2 then I like to add the string -n to that number. Here's my code: read -p "Enter a number " result_sort if [ $result_sort ...
0
votes
1answer
20 views

customizing mkisofs as cross-platform as possible

I have a relatively large archive from which my students would select files to create iso images, which they take home on their pen drives to burn their own DVDs. In order to make the process as ...
0
votes
1answer
3k views

Sed error “sed: -e expression #1, char [#]: extra characters after command”

sed '/\r$/ {N s/\n//}' sed: -e expression #1, char 10: extra characters after command I want to understand what is wrong with my command line. When I can do the some of following in a script ...
31
votes
2answers
8k views

How do I reload .inputrc?

Background I have heard that the readline module is reading ~/.inputrc and that is how it changes the behaviour of keystrokes under programs such as bash. Question How can I reload this after ...
1
vote
2answers
12 views

Linux/Bash: Create relative soft links to files in directory tree?

I'd like to make links to all files in a directory tree. Which means, create the same directory structure and make the links in them to the respective subdirectory in the original dir. That could be ...
0
votes
0answers
12 views

Monitoring a log file and send a notification (mail) when string is triggered

I want a nofitication (email) when the user-foobar is triggerd in the apache log like this 10.10.55.171 - userfoobar [21/Nov/2014:12:06:01 +0100] "GET /download/2719/test.jpg HTTP/1.1" 200 ...
0
votes
0answers
33 views

Maintain screen session when executing shell script on boot

Solved: I solved this problem by introducing a delay before executing the script: @reboot sleep 60; /root/start_server.sh On Ubuntu 14.04, I have a crontab entry set to run on reboot: @reboot ...
1
vote
1answer
25 views

cpio VS tar - what the best archive solution in order to compress hundred of directories to one file

in my Linux machine under /var/Recording directory. I have hundreds directories and each directory there are also directories and files include hard links and soft link . I want to compress all ...
1
vote
1answer
18 views

Linux/Bash: Create relative soft links to files in directory tree?

I'd like to make links to all files in a directory tree. Which means, create the same directory structure and make the links in them to the respective subdirectory in the original dir. That could be ...
0
votes
1answer
28 views

Cron won't run my root script

I am on Ubuntu 14.04 (using Digital Ocean) trying run a script as root. It's a script to check if a server is running and restart if it has crashed. The issue isn't the script, but crontab won't run ...
0
votes
0answers
61 views

Why does read's timeout break my console?

I have a script that is causing an issue, I've boiled it down to this; #/bin/bash read -t 1 -p 'Wanna continue?' less +F readTimeout.sh echo 'Wont get printed' The original script operated by ...
0
votes
2answers
39 views

Find repeated words in a text

One of most common typos is to repeat the same word twice, as as here. I need an automatic procedure to remove all the repeated words in a text file. This should not be a strange feature for a modern ...
0
votes
1answer
5 views

accessing EC2 instance from cygwin

I should follow these instruction to connect to my EC2 instance with cygwin : $ cd ~ $ cp /cygdrive/c/Users/JohnSmith/Downloads/cs184-john-stanford-edu.pem . $ chgrp Users ...
2
votes
1answer
88 views

How to force wget to output a summary?

I have a bash script that launches a series of wget commands and log the output. I use the following options: wget --no-verbose --page-requisites --adjust-extension --convert-links --backup-converted ...
4
votes
1answer
167 views

Unable to launch application in tmux

I get this error when I try to launch Sublime Text or SourceTree from tmux: $ subl Unable to launch Sublime Text 2 $ stree Unable to open SourceTree It seems that I can't open os x apps either: $ ...
6
votes
3answers
340 views

How can I easily see the man page for builtin shell commands?

If I see a command in a script that I don't know and I type (for example) man pushd or man umask I see the man page for builtin commands. I know that I can do man bash and scroll to find the help for ...
1
vote
1answer
16 views

How to change linux file owner and run using crontab?

I have a bash script with user ivr. How can I change the user ivr to root? Currently it has: -rwx------ 1 ivr ivr 543 Nov 22 16:46 db-backup.sh I wanted like below: -rwx------ 1 ...
0
votes
2answers
22 views

How to store results of multiple sql queries in shell variables in Bash?

I need to store in array the results retrieved from the database. So far this is basically what I'm trying with no success. Myarray=$(echo "SELECT A, B, C FROM table_a" | mysql database -u $user ...
0
votes
2answers
29 views

How can I scp a file across two servers in one line? [duplicate]

I'm using Mac 10.9.5 and bash shell. In our environment, we have to go through a proxy (a CentOS machine) to SSH properly into a destination machine (another CentOS machine). What I would like to do ...
0
votes
0answers
16 views

Add credits to the end of the video

Is it possible to use ffmpeg to make credit titles at the end of the video ? I have a very long string of authors separated by comma as input. Managed to create 1 frame and append all the string to ...
25
votes
4answers
65k views

How can I change the default Python version on Snow Leopard?

I recently upgraded my Mac OS X 10.5 Leopard install to 10.6 Snow Leopard, and with that came an upgraded version of Python, 2.6.1 (instead if 2.5.1). Now when I type python in the Terminal i still ...
4
votes
4answers
4k views

How to ignore error messages in bash on Ubuntu?

I'm trying to show the number of lines, words and characters of all configuration files in /etc/*conf (with command wc). How can I modify the command (or commandline) to not view the error messages?
1
vote
1answer
11 views

ps aux status column meaning?

On a Mac, 64 bit, osx 10.8.5, two of my ps aux output lines, plus the header, are ; $ ps aux | head USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND myuid ...
1
vote
1answer
19 views

Is there an event fired right after a command finishes executing?

In Bash, after you type in a command (e.g., ls), it will execute the command, which will write its standard output (if not redirected) to the terminal (in our example, the content of the current ...