Bash scripting is making scripts in the Bash shell language.

learn more… | top users | synonyms

2
votes
1answer
129 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
38 views

How to daemonize a bash script only if --daemon flag is given?

I have my script.sh and want to run it with ./script.sh or ./script.sh --daemon, having it remain in the foreground unless the --daemon flag is given, in which case it should detach and go into the ...
1
vote
1answer
79 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
88 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
48 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
977 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
683 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
44 views

How to execute multi-line ssh command stored in a variable

Context: I'm trying to execute a bunch of commands on a remote machine that I cannot access directly - I first have to ssh into a gateway machine, then ssh from there and run the commands. Basically ...
0
votes
1answer
31 views

$RANDOM in script vs. on command line

I think I found a really odd bug in Bash's random number generator ($RANDOM). Showing is easier than telling, so here's what happens: The goal is to get random digits. If I execute this, I get 20 ...
0
votes
1answer
147 views

Require bash script to be run with sudo (not as root user)?

I want to require a bash script to be run as the current user with sudo, but prevent it from being run if it was executed as the root user directly. This is because I'm doing some setup actions for ...
0
votes
1answer
23 views

How to detect ips using nmap?

I am currently working on demonstrating Man in middle Attack foe which I am using my phone as a Victim and my PC running ubuntu 14.04LTS as attacker. I am using nmap to ping my phone to check if its ...
0
votes
1answer
63 views

Bash function only works when password manually input

At work I have to run the following function everyday. The function works fine when I am prompted for the password. However, I tried to hardcode my password so that I don't have to enter it in each ...
0
votes
1answer
18 views

Move spam emails from directory - bash script

I am trying to write bash script wich can cleanup my whoole server from spam emails that already are present in my client's folders. I would need this script to do, Check recursively directory ...
0
votes
1answer
25 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
441 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
48 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
45 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
492 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
789 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
300 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 ...
1
vote
0answers
17 views

Grep from Log & Calculate then alert

I have a log file, which has the below lines in it. I need a bash script, which takes the values in Bold (4092.1M / 20.1G) & do the math & then alert from Zabbix [Eden: ...
1
vote
0answers
750 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
149 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
8k 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
20 views

bash behavior on sigterm

Have a script as below: #!/bin/bash # # run this script. don't run it if it's already running. # PIDFILE=/tmp/script.pid LOGFILE=script.log if [[ -f $PIDFILE ]]; then echo "$PIDFILE exists. ...
0
votes
0answers
10 views

Remove orphaned data without corresponding torrents in the rtorrent's list

I use rtorrent with a plenty of frontends like ruTorrent and Transdroid. Often, when I try to delete both the torrent and data through these frontends, the torrent is removed from the list but the ...
0
votes
0answers
18 views

shell script to generate a log file for VM Backups

we are using PHD virtual backup to trigger backups for VMs and now i want to generate a report of all VMs in a file consisting of VM Name, Date and Backup Time and mail it to my ID at particular ...
0
votes
0answers
37 views

+Merlin FW / Port Forward via IPtables?

I have 2 WiFi Thermostats, Heatmiser, that i can control remotely, from LAN without issues, but only one from WAN. The thermo have a fixed port that cannot be changed and there is an App thet can be ...
0
votes
0answers
23 views

Having trouble building Vagrant bash script

I'm trying to set up a bash script provision to help build my virtual machine with Vagrant, but I'm clearly doing something wrong. Unfortunately the Vagrant docs don't provide any examples more ...
0
votes
0answers
24 views

Spawn new consoles from script and get back to the main console instance

The goal is to use a script to launch and execute a command in n separate window terminal: (I use lxterminal) It works when I copy/pase the following block of commands, It executes each lines ...
0
votes
0answers
67 views

how to grep exact pattern

I’ve tried several grep / egrep ideas with different options but none worked here. I’m trying to grep exact match of the pattern I’m looking in a log. For example I want only a pattern “ERROR” to get ...
0
votes
0answers
12 views

Curl should be quit but it returns ever something

I tried to login to a website using curl in a bash-script. It is possible to login to the site quiently using this: curl -d "username=$username&passwd=$passwd" -c $cookiefile ...
0
votes
0answers
15 views

avoid sigstop in script bash

alias notesave=' cwd=$(pwd) && cd ~/Desktop/Notes && git add * && git commit -a -q -m "-_\@" && git push -q origin master && echo "DONE!" && cd $cwd' ...
0
votes
0answers
26 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
93 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
23 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
41 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
69 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
77 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
20 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
43 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
11 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
33 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
66 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
54 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
114 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
279 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 ...