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

learn more… | top users | synonyms

0
votes
1answer
67 views

I do not understand -printf script

I have taken over the responsibility of RHEL5 scripting and I've not had any training in this platform or bash scripting. There's a script that has multiple pieces to it and I will ask only about the ...
0
votes
2answers
2k views

Replace on Nth Occurrence

I have This Code sed '/Sometexts/ r newtext.txt' old.txt > new.txt This Replaces The String 'Sometexts' with the contents of text file newtext.txt but i want to replace on the 2nd ...
1
vote
2answers
443 views

Is it possible to grab and store the returned window id of a terminal opened through applescript or bash?

I have been working on this "dashboard" to help control my localhost server environment. It has been scripted in bin/bash for reference. I recently discovered I can use the bin command "osascript" to ...
1
vote
2answers
78 views

Logging in over ssh in a different session?

I don't know exactly what the correct term is, but I notice if I log in to a remote SSH server, then close the window, open a new one, and log into that server again, my bash history and user ...
0
votes
2answers
3k views

Print current time (with milliseconds)

I want this command in windows with cygwin installed, so any Linux command will work for me.
0
votes
1answer
285 views

How do I write a bash script that makes a phone call on my cell once a matlab process finishes?

If not a call, is sending a text message possible? I have tried setting up an email notification and that worked, but I would prefer if I got a call or a message.
0
votes
1answer
49 views

apt-cache show bash script

I'm trying to write a bash script that will ask echo "What programme do you want to see?" and then give the answer as 'foo', so that 'foo' can be read by the line which says apt-cache show foo|grep -i ...
1
vote
4answers
349 views

How to list folders in bash without the trailing /

I know ls -d */ lists all folder in current directory as dir1/ dir2/ dir3/. Is there the possibility in a bash script to show folders as dir1 dir2 dir3?
0
votes
1answer
1k views

su in shell script started from ssh works in other terminal

Sorry my dumb question but I don't know how to describe my situation. There are logs from Jenkins: ssh www.myserver.com '/var/lib/tomcat7/webapps/deploy_webapp.sh' + id uid=1004(jenkins) ...
0
votes
1answer
92 views

Use date to update date

I am trying to follow along to the exercises in Beginning the Linux Command Line. One of the exercises asks to set the current time to 1 minute ago. While I can get the time one minute ahead: echo ...
1
vote
1answer
215 views

How to bulk rename files by cutting starting at a certain character

I have music file with crappy file name like this: LetMeBeTheOne[Outtakeb-SideTolongMistyDays[2010DigitalRemaster-1.mp3 TheFoolAndMe[DigitalRemaster.mp3 I want to rename the file by cutting ...
1
vote
1answer
47 views

Set bash variable so that it can't be unset

I'd like to set an environment variable for all users via /etc/profile that the users can't override or unset. I'm pretty sure this is possible, but I'm having trouble locating the relevant ...
1
vote
2answers
123 views

Unhide all .htaccess files on mac

I am trying to unhide all the .htaccess files in my home folder. Below I've pasted what I'm using now, but it isn't working. find ~/ -iname ".htaccess" | xargs chflags nohidden "{}" Anyone knows ...
1
vote
1answer
48 views

Cygwin unable to compile

I just downloaded Cygwin, I've never used it before cause I've always used putty. Cygwin is not letting me compile; I can see the files but it just doesn't let me compile and I do not understand why, ...
1
vote
1answer
235 views

Tab title is wrong with ssh/screen on osx

I am doing ssh -t host screen -D -RR in OS X (10.9) terminal tabs. My ~/.screenrc is identical on all remote hosts and contain the following line: hardstatus string "%H(%n:%t)$USER %h" My ...
1
vote
1answer
885 views

Running command in new bash shell with --rcfile and -c

I'm running the following command and would expect that it would return me BAR, as the new shell I create will run .mybashrc first, where it sets $FOO before echo $FOO will execute. bash --rcfile ...
1
vote
1answer
315 views

Write text into first lines of every file

I want my web application to be free software, with a GNU license. I've read that I should add my name and the license in every file. I have a lot of files, so I guess that I could execute a command ...
0
votes
1answer
926 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
156 views

Cannot export or set variable in new shell

I experienced something weird when working on a issue. This command does not seem to work. (Using ` to fill blank line). When using export > /bin/bash -c "echo $FOO; export FOO=BAR; echo $FOO" ` ...
1
vote
1answer
358 views

Why do I sometimes get 'sh: $'\302\211 … ': command not found' in xterm/sh?

Sometimes when I simply type a valid command like 'find ...', or anything really, I get back the following, which is completely unexpected and confusing (... is command name I type): sh: ...
0
votes
1answer
766 views

Running a bash script from an HTML link or button

I have a webserver that's hosting lots of images. I want the client to be able to press a button or a link, which will run a bash script, which will create a video based on all these pictures. The ...
2
votes
1answer
223 views

time command - output to a file

comamnd line: time myprocess outputs its results: OUTPUT FROM MY PROCESS real 0m1.954s user 0m0.086s sys 0m0.052s But if I do time myprocess > outputfile.txt my outputFiel.txt ...
1
vote
4answers
199 views

Mac OS X keeps “old” environment variable around

So far I had /Applications/play-1.2.5/ added to my $PATH variable. Now I'm working with 2.2.1, which I installed in /Applications/play-2.2.1 and changed in ~/.bash_profile (which is getting sourced at ...
1
vote
1answer
503 views

Linux: Copy files with dates in filename between two dates

I have a folder full of files where I from time to time need to copy a subset of these to somewhere else for processing. The files have the date they were created in the filename, i.e. ...
0
votes
1answer
210 views

Shell script for replacing string in all PHP-files, for each user

Each user has some php-files using a shared database commondb. I want to iterate over all users (in users.csv), and in their home folder (e.g. /home/joe) find all php files recursively, and replace ...
0
votes
2answers
510 views

Unable to get ls to recognise LS_OPTIONS or LS_COLORS?

Trying to get --color=auto as the default ls argument. $ ls --version ls (GNU coreutils) 8.21 … $ echo $LS_COLORS ...
0
votes
2answers
320 views

Problems with torrent names with brackets in their name

So when some torrent got downloaded then i execute one script. Like this system.method.set_key = event.download.finished,create_torrent,"execute=~/s.sh,$d.get_name=" The problem with this is - like ...
0
votes
1answer
427 views

MAC OSX Mavericks, using bash to see “Get Info” attributes

I want to use my bash shell to see the attributes that are shown when you right click on an Application and click Get Info. The specific attributes that I want to know whether or not they are checked ...
0
votes
1answer
235 views

How to batch rename files using bash

I know there are lots of such questions, but I couldn't find one (or a combination of several), which describes the things I want to do. I think I need to use regular expressions, but I am not very ...
1
vote
1answer
63 views

bash says '[[:' not found. what does that mean?

While running a bash script, I get this error: sh: [[: not found How can I find what where is the problem?
0
votes
1answer
157 views

Bash Script Success Echo

I'm working on my first bash script that will deploy VMs into a cloudstack enviornment. The script below will deploy 4 VMs. What I'd like to include is an echo message at the very end of the script ...
0
votes
1answer
152 views

Bash Append Suffix to Variable

I'm trying to write a script that would add a prefix to a variable, but I can't seem to get it added. I've tried using ++1 and a few others but I'm not sure how to do this. Here's the bash ...
2
votes
2answers
825 views

See all output from commands performed inside screen

I am using screen (http://www.gnu.org/software/screen/manual/screen.html) to access my minecraft console. I created a server in /etc/init.d, and have minecraft running in the background. Then, to ...
0
votes
1answer
58 views

Move numbers in a filename to the start

I have several files in a folder, with names in the form: SOMETEXT1 number SOMETEXT2.mp3, or SOMETEXT number.mp3. I want to rename these to number SOMETEXT SOMETEXT2.mp3, or number SOMETEXT.mp3. Using ...
0
votes
2answers
108 views

what's the error code “123” of the wget means

when i use the gun wget (version 1.13) to fetch a file list like this: cat url.txt | xargs wget -c -P ../data/ Then, I get the exit code 123, what does it means? thx:)
1
vote
2answers
224 views

Automating video generation by adding an intro and a trailing video to the main video

I have a video project I am trying to compile. Here is the overview: I have many videos which are 5 minute training sessions - Main video. The Intro Video will be a standard 5 second video that will ...
1
vote
1answer
75 views

Return control to shell DURING `gvim -f`

I occasionally use gvim -f to start gvim but force the shell to wait for the gvim session to end before resuming execution of whatever it's doing (for instance, I usually edit my bash aliases using an ...
2
votes
1answer
1k views

Unset Environment Variable in Mac

On Linux I can unset an environment variable (not set it to an empty string, actually remove it using the --unset flag like this: $ env --unset=DATABASE_URL rake assets:precompile This same command ...
0
votes
1answer
334 views

Error while executing bash command stored in string

Wrote a bash shell script that uses rsync to deploy files to live web server. Right before executing, the script outputs the full command that the my shell script generates: rsync --chmod="ug=rwx" ...
0
votes
1answer
447 views

Scripting with rsync, pulling more than the return status

I have a script to backup my images and alert me to the status of the script which gets run every 5 minutes. However, I want to figure out how to identify when rsync was successful, but didn't do ...
1
vote
3answers
2k views

How can you display host IP address in bash prompt?

Like above, I'd like to display IPv4 address of eth0 (or part of it) in PS1 or bash. Is there a way to do this?
0
votes
1answer
63 views

How can I style the command being entered in a bash prompt?

While watching this intro video to Brunch, at about t=1:30 the command prompt being used has some very cool styles. The part I'm interested in is how the presenter managed to colour the text being ...
2
votes
1answer
174 views

How can I tell what command is running on the remote end of an ssh connection?

Tl;dr - how do I find the name of the command (eg $BASH_COMMAND) running on the remote end of an ssh connection? ... My example setup is two tmux vertical panes, LH pane runs a local vim session ...
0
votes
1answer
328 views

bash getopts doesnt see flags after first argument

I'm trying to handle flags after the first argument in my bash script, but getopts only returns the flags before the argument. or flag in getopts; do case $flag in d) echo "-d ...
1
vote
2answers
94 views

Alias for directory using a symbol

I'm looking to set up an alias for my work directory, which can change as I change context, and I was trying to find something that was short enough to stand in as a replacement for ~. I'd be tickled ...
1
vote
2answers
107 views

Bash: verify that process has stopped

I'm working on script meant to start/stop a set of services. For stopping, it has to terminate many processes which take a while and might hang. The script needs to verify that the process has indeed ...
1
vote
2answers
2k views

How can I start new window in the same screen session automatically?

I read How can I start multiple screen sessions automatically?, but I don't understand the first accepted reply: screen -dmS "$SESSION_NAME" "$COMMAND" "$ARGUMENTS" In my case I need to ...
3
votes
1answer
989 views

dropboxd Syntax error: “)” unexpected

I am trying to install dropbox(x86_64 version) on Ubuntu 12.04 LTS, with this installation guide: ...
1
vote
1answer
61 views

space at the end of variable is killed on output

I'm on Ubuntu 12.04 with bash 4.2.25(1)-release. If I use #!/bin/bash echo -n 'test ' > text; echo 'test2' >> text; everything works fine and the output of text is test test2. But if I use ...
1
vote
3answers
292 views

Two simultaneous commands, then sequential commands?

So in Linux, I want to run a script 4 times, then do stuff to the output. I can do: script 1 > output1.txt script 2 > output2.txt script 3 > output3.txt script 4 > output4.txt cat ...