Bash scripting is making scripts in the Bash shell language.

learn more… | top users | synonyms

0
votes
3answers
256 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
228 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
243 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
87 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
44 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
662 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
284 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 ...
1
vote
1answer
15 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
44 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
384 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
46 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
689 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
557 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
25 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
22 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
113 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
450 views

Problems using EXPECT is a BASH shell script

This is the code (bash script): echo "Pass for router:" read -s pass /usr/bin/expect <<EOD spawn ssh 192.168.10.1 -l root 'opkg list-installed' > list-installed.txt #echo @pass expect ...
0
votes
1answer
314 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
244 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
40 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
158 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
266 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
114 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
5k 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
6 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
0answers
46 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
27 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
31 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
82 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
108 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
45 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
57 views

Geany IDE save files with bash command?

Is there any way to save open files in Geany IDE with a bash command? I have a bash script to compile source files for me, but I want it to save the file before compiling. "What I would like to use ...
0
votes
0answers
84 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
215 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 ...