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

learn more… | top users | synonyms

0
votes
1answer
71 views

not found error when executing bash script on Mac OS

I'm trying to build jDom-b4(a Java library) from the source with the script provided in the source. The content of script named build.sh: #!/bin/sh echo echo "Java and XML Build System" echo ...
0
votes
1answer
765 views

init.d script - Permission denied

I'm trying to create a init.d script for my server which should start/stop the teamspeak server and some node.js apps using "pm2". Here's my script: #! /bin/sh ### BEGIN INIT INFO # Provides: ...
0
votes
1answer
40 views

I accidentally put a space in my path then moved lots of files - where are they?

I used the following code to move a lot of files: sourceDIR=/Volumes/MCOOPER/data destDIR=/Volumes/MCOOPER2 /data for i in {1..6000} do mv $sourceDIR/run$i.mat $destDIR/ done Now all my files are ...
0
votes
1answer
111 views

Imagemagick text to file batch

I want to convert text to images, but the text varies. I would like to make this a batch job. This is my first stab at the problem: #!/bin/bash COUNT=$(ls -f *.jpg *.png *.gif | wc -l) for f in $( ...
0
votes
1answer
43 views

get a command process back after closing a session

Arrrgh! I'm using one of those drop down shells (guake, I think) on Linux. I'm dd-ing an SD card, and I accidentilly closed the shell session that was running that command. The light is still ...
0
votes
1answer
53 views

Error mounting in fstab Ubuntu

'm working on a bash class project which needs me to create 2 partitions in Ubuntu and make them be automatically mounted each time the systems boots with fstab. I got the following file which ...
0
votes
1answer
129 views

Using EXPECT script with a $ in the password

I'm trying to set a variable in a Linux bash script which includes a $ symbol, i.e. password is Gl@d1us$123 so PASS="Gl@d1us\$123". I can preceed the $ with a \ and it works fine, but when it calls ...
0
votes
1answer
61 views

Replacing subString in an array with bash

What I got: array[0]="Programm is Running" array[1]="programm is down" What I want: array[0]="Programm is \e[0;32mRunning\e[0m" array[1]="programm is \e[0;31mDown\e[0m" This will make things a ...
0
votes
1answer
47 views

What is the most effective linux program to perminanlty delete a file?

Some people recommend, whipe, srm, shred, etc. Is there one best assuming that the goal is to make a file irretrievable, regardless of time/space taken to delete? It would also be great if you could ...
0
votes
1answer
70 views

Brace expansion seemingly not working in Bash 3.2.51 on Mac OS X

I have a bunch of LaTeX files on my Desktop: ma 512 hw 11.log, ma 512 hw 11.aux, ma 512 hw 11.tex etc. I want to use brace expansion to print them to the Terminal. E.g., ls *.{log, aux} But ...
0
votes
1answer
157 views

Change ConEmu directory to working directory with Git bash

I currently have the following to open a git bash instance: -new_console:"%ProgramFiles%\Git\bin\sh.exe" --login -i The above starts the new tab in the home directory. I'd like it to start in ...
0
votes
1answer
100 views

Bash Sum Average numbers in files

I have a series of files with 2(two) lines. The first line contains a whole number (1-100) while the second line contains a decimal number(1.0000-99.9999). I need to get the sum of the first line and ...
0
votes
1answer
251 views

Better setting of EDITOR environment variable to use Sublime Text 2 as system editor?

I want to use Sublime Text 2 for editing Git commit messages. Right now I have the following in my bash rc file: export EDITOR="sublime -nw" This works well if Sublime is already running. But if ...
0
votes
1answer
107 views

Way of identifying plaintext file types in bash?

Is there any alternative to the file command that can be used to identify plaintext file types that don't have a magic number? E.g. something I can give a file to that contains JSON and I'll get back ...
0
votes
1answer
85 views

Confirm if directory exists in a specific location then Run cmd 1 if not cmd 2

I have two scripts that I would like to merge into 1 batch file. The scripts just delete temp areas on windows 7 or xp, I would like to combine them by creating a conditional statement that states IF ...
0
votes
1answer
68 views

Concatenate header of one file with tail of another

I have a large gzipped mysqldump file which contains some table definitions and then many insert statements. I'd like to edit the table definitions but leave the insert statements alone. The file is ...
0
votes
1answer
22 views

Bash return stderr of the first failed process

I need to run some commands and if any of those fails I would like to output JSON with it's stderr. I have the following line: OUT="$( (ssh internal "custom_script1" | custom_app1 2>&- | ...
0
votes
1answer
40 views

Set ENV variable for all commands in current directory in mac os

Is there a way to run all commands in current directory with some ENV variables predefined? Example of what I need: I put some file, say .env in my directory, with: export SECRET='abcd123' Then I ...
0
votes
1answer
74 views

OS X: invalid option -o

When I open terminal I got the following message invalid option: -o. I cannot use /bin/bash --login because I got the same result. I think that terminal try to execute bash login which can't be ...
0
votes
1answer
42 views

How to match .grd data and .txt data

I have a lot of data in .grd and .txt formats, for example: 20121201.grd 20121202.grd .. .. .. 201121231.grd and also: Result.2012.1201.txt Result.2012.1202.txt :: :: Result.2012.12.31.txt I ...
0
votes
1answer
53 views

How to stop and continue the process

I used ps -fT pid to manage a bunch of process forked from the specified pid. Now I want to modify some settings so I want to stop the processes whose pid is in ps -fT pid. After the modification ...
0
votes
1answer
305 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
46 views

What does “vi-move” keymap in Bash's vi mode actually do?

The keymap section in the Bash Reference Manual says that one of the acceptable options is "vi-move". There doesn't seem to be any description for what this corresponds to. I'm well acquainted with ...
0
votes
1answer
170 views

Issues with this sh script?

Having issues executing this sh script...i don't see anything wrong with it, does someone else see something I screwed up? echo "**************************************" echo "*** ...
0
votes
1answer
57 views

How to restore virtual host configuration on Mac OSX

I successfully created some virtual hosts on my machine a while ago by modifying my /etc/hosts file and my http-vhosts.conf file. Then I found a very handy tool called virtualhost.sh ...
0
votes
1answer
26 views

Detecting reasons for scp of glob failing

I am scp-ing some files from a remote host in a script. I want to know if anything fails, most commonly due to permissions issues. The files being copied belong to a different user and sometimes the ...
0
votes
1answer
81 views

how to keep number of files in a folder less than a limit

I'm trying to create a bash script to limit the number of files to a limit of 50000. I want to run the bash script on crontab every 5 min so it can keep deleting the old files when the number of ...
0
votes
1answer
39 views

Is it possible to connect to the local Windows shell with PuTTY?

I don't know of a working Windows SSH server (not one that I trust enough, yet, at any rate). Therefore, I can't simply connect to localhost on port 22 from PuTTY. I want to use PuTTY because the ...
0
votes
1answer
88 views

iterating bash script for cycle in a file

I try to make this very simple bash program that must make the following operations: modify a file java n times: every time I must change a single word in a single line of the file (the line is 11) ...
0
votes
1answer
227 views

What can I do about “cannot execute binary file”

I have a little shell script that simply starts up a Java program. It is installed somewhere deep in the hierarchy, so I don't want to add its containing folder too my path. So I put a symbolic link ...
0
votes
1answer
76 views

Moving directories based on .md5 file to restore original directory structure

I ask for help regarding some scripting. I have a directory "J:\To_Sort" which contains another 1164 directories. Inside the "To_Sort" directory I also have 37 *.md5 files. These MD55 files contain ...
0
votes
1answer
250 views

How to properly open a SSH tunnel for a program and close it afterwards?

I want to run a command that needs a SSH tunnel for its operation (opening TCP connections repeatedly). After it exists, the tunnel needs to be closed again. The problems I encountered are: I can ...
0
votes
1answer
124 views

moving the directories using find command

I am trying to find particular directory in one path and move the directory in other path using find. Source directory looks like below, /Dir1/country1/month1/date1,date2,date3 ...
0
votes
1answer
771 views

How to check if a file exists on a remote server

I want to test if a file exists somewhere on a remote Linux server (e.g., /var/run/test_daemon.pid), without logging in to the server interactively. For example, you may want your script to behave ...
0
votes
1answer
275 views

how to check for duplicates and rename file if there are any while copying them from another source

It's a script in bash, it copies files from one directory into another but there may be duplicates in a sub-directory. So while copying, it should recognize if a another file has the same name and if ...
0
votes
1answer
556 views

Recursively copy and rename to replace spaces with underscore

I have a directory with 400 sub-directories each containing several hundred files many with filenames that contain spaces. I need to copy all of the files with spaces in the filenames, resulting two ...
0
votes
1answer
227 views

crontab a bash script that is copying certain files

First I would like to say that I am terrible with scripting so this has been a true challenge for me. Any input would be great! I would like to automate an sftp transfer every 24h. If I am lucky in ...
0
votes
1answer
606 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
199 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 ...
0
votes
1answer
362 views

How to configure in crontab with condition statement for checks

We like to monitor the NAS storage mounted on a Linux box. We only like to be notified via mail when the usage exceeds a certain number, say 80. We have only seen in Linux books where most of them ...
0
votes
1answer
196 views

UNIX script to LPAD update query in cat file

I want script which will open the text file data and write update query to those file and save in SQL file which will get executed through cron. I have prepared command but its writing the update ...
0
votes
1answer
241 views

Debian ssh user TAB behaviour changed - how to revert it?

I have created new user with: useradd u passwd u When logged as u via PuTTy the TAB key behaviour is changed: autofill dir/filenames and commands not working the tab is placed instaed (4 spaces) ...
0
votes
1answer
72 views

trying to install Astromenace on my linux mint 14 cinnamon pc

so i am following this tutorial as it is the only one i can find and any that i can find are the same as this one: http://linuxg.net/games-on-linux-how-to-install-astromenace-on-ubuntu-and-fedora/ ...
0
votes
1answer
73 views

bash terminal: can the find and make duplicate text be extended globally--Apple?

From Finding and removing duplicate files in osx with a script, can this be extended to find duplicates across the whole hard drive instead of per folder? I know there are duplicates but they aren't ...
0
votes
1answer
376 views

Type an EOF without a line break

I have a little command that I use to copy/paste files around that involves pasting the base64-encoded tar archive into stdin, but the base64 utility keeps giving me and error message about my input ...
0
votes
1answer
62 views

What would an update mechanism look like in bash

I have to update a script compilation from time to time but I haven't any idea how to start a version check script in bash. I've got a version file with 3 vars: version=0, subversion=0 and ...
0
votes
1answer
317 views

howto change screen hardstatus dynamically with format, from shell?

howto change screen hardstatus dynamically with format, from shell ? I successfully configured screen using 256 colors and tabs and so on, here is my .screenrc : http://pastebin.com/g8XbMWBH I use ...
0
votes
1answer
70 views

Bash script: allow change of “environment/identity”

I came across this problem now several times and I would like to find a way to automate/script this things that involves a change of identity or environment (I am not sure how to call that precisely). ...
0
votes
1answer
97 views

rsync in a bash script appears to work, but the files aren't updated on destination server

I've got a server where I do my web development and testing, and I have a bunch of frontend servers that sit behind a load balancer. I wrote a simple bash script to rsync a directory on my dev server ...
0
votes
1answer
132 views

profiling file reading speed via /dev/null?

I am profiling the speed at which a certain Linux program reads a certain input file using different amount of threads by doing this: time ~/src/myprogram -t $t inputfile 1>/dev/null ...