Bash scripting is making scripts in the Bash shell language.

learn more… | top users | synonyms

0
votes
3answers
331 views

Is there any way to encapsulate bash functions?

I'm writing a simple script script.bash that is supposed to export some variables environment, to use it in my current session I have to source it $ . script.bash script.bash function fun1() { ...
0
votes
3answers
253 views

win-bash won't detect root drives?

I'm using the windows port of bash known as win-bash, and based on what it says about paths: One important difference is the handling of drives: cygwin uses its installation directory as root ...
1
vote
2answers
53 views

Restarting process in CentOS if server restarts

I have a VPS with some Java applications (made with "Play Framework") running on ports 9000, 9001, 9002 and 9003. VPS Provider (iPage) happens to reboot servers unexpectedly from time to time, leaving ...
1
vote
2answers
306 views

Revising a bash script - Invoking a change of prompt color via a temporary file

I am wondering why the following script won't work: #!/bin/bash read -p 'First lets write PROMPT.SH' echo '#!/bin/bash'>prompt.sh echo "export PS1='\e[1;31m\]\u@\h \W\$\e[0m\] '">>prompt.sh ...
0
votes
2answers
270 views

Getting errors trying to run shell script (Linux)

I'm trying to run the following script. I have run it before without issue, but now I encounter an error. #!/bin/bash # init function pause(){ read -p "$*" } echo & echo "(Website):" ...
0
votes
2answers
57 views

Script variables not printing as expected

In an attempt to debug a script, I'm printing variables containing text, pretty standard stuff, except that the variables are not behaving as expected. I've discovered that one of the lines of a file ...
0
votes
2answers
857 views

keep environment when executing in script

I have a bash script that should be executing a number of commands. The commands work fine when entered in a termainal but when I try to execute them from inside the script they don't work, so I ...
0
votes
2answers
321 views

sound detection accessing device node directly

I am attempting to invoke a bash action triggered by audio input. A very simple sound detection sensor (no record) with adjustable threshold utilizing a pc's onboard audio chipset and audio microphone ...
2
votes
1answer
91 views

Unable to Create Files In Directory

There are lot of these kinds of questions on superuser, so I'll try and keep this quick by telling you what it's not: There is no application involved here. Just a user and a filesystem. I can login ...
1
vote
1answer
7 views

Homebrew script to reinstall formulas

I'd like to develop a bash script to capture the currently installed Homebrew formula, then be able to reinstall these formulas in the event that I need to reinstall my OS. I'm hoping to combine ...
1
vote
1answer
59 views

Directory auto completion in bash scripts

Bash scripting newbie here writing my first script to copy a directory of pictures from one place to another. #!/bin/bash # Moves picture directories cp -R /path/to/pictures/$1 ...
1
vote
1answer
57 views

Find last 24 hours executed commands per each user in bash

How can I find last 24 hours executed commands per each user and mail them the result? I have Ubuntu GNU/Linux. I find out that I need a package named 'acct'. I have already installed and enabled that ...
1
vote
1answer
582 views

extract characters between first and second underscores of filenames and count such files in linux folder

I would like to extract characters between first and second underscores of filenames in a folder and count such type of files present in it. The folder contains files in a particular format such as : ...
1
vote
1answer
47 views

UNIX Scripting Possibilities

Need a small help to understand if a task can be accomplished using UNIX script. Situation: Symantec Endpoint Encryption when installed on Mac, a manual intervention is required where a technician ...
1
vote
1answer
803 views

Bash Script: Redirecting to file gives “Illegal Instruction”

I'm trying to use a bash script for a study assignment. As a bash noob, I tried to adapt an existing one to suit my purpose: Compile/Make a C-program with different compile arguments, execute it and ...
1
vote
1answer
639 views

BASH: How to best filter directories of files for a certain date range in the filename?

Here's the picture... Date format: Y%m%d%H%M%S% This is my filename format: file_sub1_20110501000000.txt Directory structure: dir/ sub1/ file_sub1_20110501003000.txt ...
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
92 views

How can I apply quotes to a URL in a .bat script?

The general form of a curl command in CMD that works is: curl -o latest.dump -L ...
0
votes
1answer
27 views

Print Windows mapping of root path in MSYS Bash

In MSYS Bash I get: $ cd ~ $ pwd /c/Users/antonio but: $ cd / $ pwd / Can I get the full Windows absolute path from Bash?
0
votes
1answer
38 views

Text file sort. Ignore rubbish and create .csv from remnants

I've got a load of files containing preamble rubbish followed by formatted information. They're all the same format. I want to ignore the preamble, (everything up to and including the word ...
0
votes
1answer
24 views

How do I extract multiple files at once?

I have a number of rar files stored like so: /torrents/televisionshowS01E0$X/nameoftelevisionshow.rar where $X is a variable ={0,1,2,...,12} I would like to extract them using a single command to ...
0
votes
1answer
303 views

How do I run multiple scripts within a script, even if one script fails

I have a simple bash script that executes a number of other scripts … #/bin/bash … ./update_artifact1.sh $ARTIFACT_VERSION ./update_artifact2.sh $ARTIFACT_VERSION ./update_artifact3.sh ...
0
votes
1answer
605 views

Start script on network connect

I am trying to get a GNU/Linux Bash script to run as soon as a network connection is established on my Raspberry Pi. I tried following the instructions on several pages: I have tried adding my script ...
0
votes
1answer
276 views

Getting error while executing shell script in Cygwin?

I have done a script (bash) and kept the same in E:\Ping folder of my local Windows 7 m/c, and I am trying to run the same through Cygwin. I'm getting a bash: sh : command not found error. What is ...
0
votes
1answer
41 views

Run a specific command from a directory

I have a bash script where I need to run an init utility within a directory with a configuration file defined. I don't think it's possible to explicitly tell the utility to run the file as an ...
0
votes
1answer
175 views

linux bash backgrounding and I/O redirection

I'm having bash backgrounding and file redirection issues. I need to attach to a remote sensor box and record the ascii datastream from that box onto disk files. I'd like to break that datastream ...
1
vote
0answers
667 views

Postgresql query within a bash script

We are having an issue with a postgresql bash query. The output of the query from the bash script add's additional quotes around the date. Please can you help me fix it?! Script: #!/bin/sh ...
1
vote
0answers
132 views

Rsync do not do anything if files not changed

#!/bin/sh date=`date "+%Y-%m-%dT%H:%M:%S"` rsync -aP --link-dest=/target/current '/source/folder' /target/back-$date rm -f /target/Backups/current ln -s back-$date /target/current This is a little ...
1
vote
0answers
7k views

how to get flash video stream URL from website without browser (telediario, rtve)

I want to access the video stream URL of telediario from spanish television (RTVE) which you can find here in a flash player: http://www.rtve.es/alacarta/videos/telediario/ I want to do this with ...
0
votes
0answers
14 views

Monitoring xinput keycodes in bash

So basically, what I'm trying to do is use the xinput command to watch for keyboard input in the background for a bash script to toggle things. I would like to ideally monitor multiple different ...
0
votes
0answers
16 views

Is “Lynx: can't access startfile” normal when I'm looking for broken links? I'm kinda desperate

I'm doing a script in bash for checking broken links, is it normal that the dialogue "Lynx: Can't access startfile" appears when I run the script? This is my code so far: #!/bin/bash ...
0
votes
0answers
30 views

Bash Script - Find “ERROR” and output to file

I'm writing my first bash script and could use some help / advice. I cannot test the script at the moment - just want to know if I have it setup correctly. I have a file $A_HOME/bin/nohup.out and I'm ...
0
votes
0answers
45 views

Create a bash file in MAC OS to add static routes and dial PPTP VPN

Create a bash file in MAC OS, double clicking it would add a specific interface based static route in the routing table and then it dials a PPTP VPN.
0
votes
0answers
23 views

Security Monitoring Using last Command

I am new to linux administration and was looking for a good way to get e-mail alerts when a user logs in. I was thinking this might be useful as a security monitoring tool to allow me to see who is on ...
0
votes
0answers
32 views

OSX Convert and Network User to Mobile User or force all Network Users to Mobile

We have Macs that I am working on binding to LDAP (not AD) and I want to make sure when a user logs in using their ldap credentials that it either create them a Mobile Account or it runs a script to ...
0
votes
0answers
18 views

Can I Query a Pdf Reader If It's On The Last Page?

I'm writing a wrapper shell-script to do the following: Searches a directory for .pdf/.djv files. makes an ordered "playlist" of files Opens 1st file in a pdf reader. Automatically change to the ...
0
votes
0answers
23 views

binary substitution in (audio)streams with bbe or sed

I try to do some stream manipulation with webradio streams. Goal is to use a pattern in triggerfile to substitute some seconds of the instream to silence in the outstream I found bbe to possibly fit ...
0
votes
0answers
7 views

Bash script query: what does NmaUtil::untaint do?

I'm trying to debug a script that uses expect to look at a remote servers disk space prior to transferring a backup file. The problem is that the remote server doesn't present the "Password" prompt at ...
0
votes
0answers
27 views

bash scripting with ssh

I am logging to a remote machine and doing some operation in a bash script. I used the following code but till chmod 777 $dbPath works and rest of the commands are not executed. ssh $node2user@$node2 ...
0
votes
0answers
13 views

Search in multiple text files for lines that start With a string and show next a date (non determined) in ubuntu terminal

I'm looking for a date (not specified) with the format "DD-MM-YYYY" or "DD/MM/YYYY" that starts with at the beginning of the line with another string. inside some txt files, and assign it to a to ...
0
votes
0answers
55 views

Autoexport bash internal variables

I need to access to some bash internal variables (BASH_LINENO, BASH_SOURCE) from a command invoked by a shell script. The only possible interface between my command and the script are environment ...
0
votes
0answers
29 views

Combining a bunch of find commands into one command or script.

I was wondering how to combine a bunch of find commands into one. This is the list of find commands I want to run and in the order. find /path/to/folder/ -name '*Sample*' -exec rm -rf {} \; find ...
0
votes
0answers
47 views

Vagrantfile - is rvm in ~/.rvm/scripts/rvm or ~/.rvm/bin/rvm?

I'm still learning my way around some of the more hidden files in terminal and I was trying to setup a Vagrant box with rails via shell script provisioning, with some help from these links: ...
0
votes
0answers
95 views

automate drive mounting after Cisco AnyConnect client is connected

I have a request to write a bash script for clients to open VPN connection and automount remote drives. I am not sure how to approach it. I figured out I can use "vpncli.exe connect " to connect, but ...
0
votes
0answers
157 views

find files between dates and move to other directory

I have multiple logs file in one of the direcortories, was trying to move them monthly wise to another path. tried below script for the same. for Month in `seq -w 1 12`; do MLDAY=$(date -d ...
0
votes
0answers
51 views

Rsync delete issue

I implemented rsync to backup the data from the server to my local machine,and done it regularly by cron. It works fine but yesterday it deletes the files from the folders on my local machine but on ...
0
votes
0answers
101 views

gnome-terminal flag sh

I'm extremely new to linux, so i kinda need some tutoring... been teaching myself some scripting. Most of the stuff I just copy of sites. what baffles me is the little flags that appear in this line: ...
0
votes
0answers
250 views

Getting a setting, the chdir value, out of GNU Screen

I've been using screen's chdir command to set a new working directory for new screen windows, more on that later. What I need to do is find out what the setting was before I set it, so that I can set ...