Bash scripting is making scripts in the Bash shell language.

learn more… | top users | synonyms

0
votes
0answers
28 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
30 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
1answer
85 views

output awk print to two separate files

Here is my current code md5sum filename.iso | awk '{print $1} {print $2}' This gives me two separate lines. The first line is the md5 of the file and the second line is the name of the file. I ...
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 ...
2
votes
1answer
48 views

Is this a bash-specific method of calling a script: VARIABLE=value bash somescript

I have worked all my life in HPUX/ksh shell, so bash these days seems to be throwing new ways of doing many things (many of which don't seem to be POSIX compliant - for example 'mkdir -p ...
0
votes
1answer
30 views

Repeat on user press, open up terminal, close terminal?

I am making a program and would like it to loop if an user presses a key. I also want to know if the bash file can automatically open a command terminal if it is not running from one to achieve the ...
0
votes
1answer
29 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?
1
vote
1answer
62 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 ...
3
votes
2answers
89 views

How to work around Bash for loop not exiting when a subcommand errors?

I have a for-loop in a shell script a la: #!/bin/bash set -u set -e for l in sh rb py php java cs; do (cd $l; ./run-tests.sh) done The intent is to have the for-loop die in a fire when any one of ...
0
votes
2answers
82 views

using 'case $1 in' to read command options- multiple flags after dash, and handling unusual flags?

I am making a bash script which uses both long options and short flags. Since I want long options, I can't use getopts. I tried using the following code: while test -n "$1"; do case "$1" in ...
0
votes
1answer
32 views

Script not working when run automatically

This script (parts of it) runs perfectly when invoked manually from the Terminal: #!/bin/bash [[ "`ps -e | grep -c $(basename $0)`" -gt "2" ]] && echo -e "`basename $0`: Mutiple instances ...
0
votes
1answer
31 views

Calling a list of functions provided on a stream

I'm writing a bash script to configure a server in which the end user will have to choose the actions to perform and the script will execute them. Each action will be implemented as a function. I've ...
0
votes
2answers
285 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
1answer
126 views

pass filename(with space in the path) as argumant to a wine app in a bash script

I want to luanch an wine App with passing a file as argument. I've two file, with the first I don't have any problem but when there is a space in the path wine can't handle the address properly. here ...
0
votes
1answer
67 views

Renaming files in a folder (and subfolders) by removing a token in filename

I have a huge amount of files in a folder (and subfolders) that I need to rename. For example, I have: movie1.mp4 fixed_movie1.mp4 ... What I need is to rename fixed_movie1.mp4 to movie1.mp4 ...
1
vote
1answer
53 views

How to make variables used in read global for the script

I want to read a file with the data ordered in column. In the script that I'm writing I use the read command. The input file is made by lines like the following: XX:XX:XX:XX:XX PQRTS ...
0
votes
1answer
20 views

Backing up github [closed]

I have a bunch of github directories and have been using a script with the "cp" command to backup to an external USB drive. I was wondering if I should be backing up directories that I make for ...
1
vote
2answers
2k views

Properly escaping forward slash in bash script for usage with sed

I'm trying to determine the size of the files that would be newly copied when syncing two folders by running rsync in dry mode and then summing up the sizes of the files listed in the output of rsync. ...
1
vote
1answer
120 views

Unable to delete a file using bash script

I'm having problems removing a file in a bash script. I saw the other post with the same problem but none of those solutions solved my problem. The bash script is an OP5 surveillance check and it ...
0
votes
1answer
287 views

Simple script run via cronjob doesn't work but works from shell

I am on shared hosting and I'm trying to schedule cronjob to run every now and then. Via cPanel I scheduled to execute my script but even though that according to my host support the cronjob runs, the ...
1
vote
3answers
285 views

bash: Use columns separate in an array

Is it possible to put columns separate in arrays, not as a line but as a column. I need to access the lines sequentially. I have one file, but in this example, the files are divided into columns and ...
2
votes
1answer
33 views

Are shebang invocations detectable?

Is there a way for a bash script to detect if it's being run via the #!/usr/bin/env shebang? Some magic bash foo that would let me write: #!/bin/bash ... if [ __INVOKED_VIA_USR_BIN_ENV__ ]; then ...
0
votes
1answer
236 views

Execute the shell command in subshell or in background?

Actually I mainly work with Ruby, but now I have created a bash script file. From this script file I am displaying the messages on the screen. Here is my scenario. I have used aosd_cat module for ...
0
votes
2answers
61 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 ...
1
vote
2answers
40 views

How do I print multiple sections in a text file?

I have a text file looking something like this: *FILESTART line_a line_b line_c *INCLUDE file_A.key file_B.key *INCLUDE file_1.key file_2.key file_3.key *SOMETHING_ELSE line_x line_y line_z *END I ...
1
vote
1answer
37 views

I am not sure what type of quotes to use in a bash script

I am working on a script. I am having it call a program that has an input directory. The program looks like this if executing it from command line /path/to/program -c /path/to/config -d ...
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 ...
1
vote
2answers
165 views

How do i run su username -c “command ” in a sequence

am trying to write a script that runs commands in a sequence as a user but su keeps doing every command at the same time instead of running them one after another the script looks like su username ...
0
votes
0answers
57 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 ...
1
vote
1answer
457 views

HandbrakeCLI bash batch script not working.

I am trying to batch encode a bunch of files. Looking over the internet I have found just a couple scripts and none of them worked for me. I started to piece together something and it is close to ...
2
votes
1answer
38 views

Can you delete all users but specified accounts in Ubuntu?

I am trying to find a way to quickly delete all user accounts except for the ones I specify in Ubuntu. Is there a good way of doing this? Perhaps a bash script that could do this function? I ...
1
vote
1answer
70 views

Move Files having No Extension

I have 5 files in a directory log.txt abc.pdf def.ppt 1CC 1DD Now I want to Move files having no extension i.e 1CC and 1DD to a another directory i.e tree. whenever i am manually using command it ...
1
vote
1answer
62 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 ...
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 ...
1
vote
1answer
59 views

How to recursively create a directory if it does NOT yet exist?

This seems like a general utility and am wondering if anything already exists. I'm trying to place a timestamped logfile in a directory after a script runs, but need to make sure the subdirectory ...
0
votes
1answer
31 views

grep and search and replace in linux accepting parameters with /

I'm trying to find and replace the contents of a file using grep and sed. grep "#!/bin/bash" ./ | sed xargs -i 's/#!/bin/bash/#!/usr/bin/env bash' How do I make sure that the string #!/bin/bash will ...
0
votes
1answer
218 views

Bind bash script to keypress

How do I map a keypress on a keyboard to a bash script? For example, when I press the "Esc" key, the script is run. OS: XFCE Spin Fedora 19 ---- EDIT ---- I need to set this via the console. This ...
1
vote
0answers
392 views

IDE for Bash shell scripting on Ubuntu? [closed]

I'm probably looking for the Holy Grail here, but I figured I'd ask. Is there an IDE for Bash shell scripting on Ubuntu (Ubuntu 12.04 in my case)? Something with a code editor that lets you set ...
1
vote
1answer
172 views

How to run a bash script in a daily basis on my remote server?

I have code need to be run in daily basis at my ubuntu remote server. How can I set it to go as described? Is there any console too to help me ? And this code should be activated itself as the machine ...
1
vote
1answer
41 views

Trim File Names of Tarballs Using Bash

I need to grade some source code from various students. The submission process is through Blackboard which appends to the file name a bunch of unnecessary stuff. Here is an example: Test ...
1
vote
1answer
101 views

Linux Bash “|” operator doesn't work - what am I doing wrong?

I am trying to check user password via login command like this: # echo "name\npassword" | login but the command ends without writing anything. echo ends because of SIGPIPE. Why did login stop ...
0
votes
1answer
56 views

find files older than create its parent folder in a directory and move them there

I've been trying to create a bash script that does the following. Use the find command to search for files older than 7 days (find . -type f -mtime +7 ! -iname '.*', take the parent directory(of the ...
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
0answers
48 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: ...
1
vote
0answers
694 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
1answer
18 views

How do I suppress the terminal window when I launch a bash script from Spotlight?

When I run a bash script from Spotlight, a terminal window launches to execute it. The window closes when the script finishes but I'd like to prevent that window from appearing on my desktop at all. ...
0
votes
1answer
51 views

Bash provide options and pass variable on choice

Trying to give an option to users of an installer to chose either "Development" or "Stable". By default the installer does "git checkout 1.1.0", but I'm turning 1.1.0 into $GIT_VERSION and trying to ...
1
vote
1answer
74 views

bin/bash script: toggle bluetooth state?

I'm trying to do an alfred workflow that toggles my bluetooth connection. STATUS=$(/usr/local/bin/blueutil status) if [ $STATUS == "on" ] then /usr/local/bin/blueutil off echo "off" else ...
1
vote
4answers
939 views

How do I get Linux commands and scripts to work on Cygwin?

I'm back with a follow up question. How do I get Linux commands to work on Cygwin? First I asked you what tool should I use to help me run my Linux scripts on Windows and you suggested Cygwin and I ...