0
votes
1answer
17 views

running for loop - but wait for string of words in log file to continue

so far I have this: for each in {01..10} ; do ./sb0$each/tomcat_sb0$each start;done that will start my apps at once, but I want it to wait until it reads one line in a file, what's the easiest way ...
0
votes
1answer
47 views

Cannot unzip with zip command line

I am having difficult unpacking a zip to a specific directory. I am trying to get all contents of subdirectory of the zipped file and not the parent directory. This is parent directory within zip ...
1
vote
1answer
22 views

How do I identify shell script execution vs dot execution

I'm writing a bash script that needs to run on the current process for it to be useful. That is, I want to make sure that the script was invoked with source script.sh or . ./script.sh and not ...
1
vote
2answers
179 views

How to create multiple folders and name them by reading lines from text file?

I have a plain text file named Export.txt. It contains a list of geographical places, preceeded by a 3 digit number with leading zeros. Example --START OF FILE-- 001 Aberdeen 002 Bellevue 003 Camas ...
1
vote
2answers
20 views

How to interrupt my script?

I use the following script (which I start from at command) as an alarm: #! /bin/sh set -m while true; do paplay /usr/share/sounds/phone.wav done & I want to bind a key to stop this alarm. Please ...
1
vote
1answer
326 views

How do I create a one time use startup script on Linux - Centos 6.x

I want to set a script that will only run one time on a Centos 6.x box and then never run again, since it's going to set some system options based on hardware and then it's all set.
1
vote
1answer
123 views

Changing the case of the Nth character of a filename using Bash?

I have a folder of files and I want to change the case of one of their characters at the 5th position. From this: ABC-xyz DEF-xyz GHI-xys To this: ABC-Xyz DEF-Xyz GHI-Xys You'll notice the X ...
1
vote
1answer
321 views

Shell Script : How use find expression in a for?

I would like to use the find command in a for. So I did this: for logs in `find $BACKUP_FOLDER -exec ls -la {} \; | awk '{ if ( $8==2011) printf $0"\n" }'`; do // some command here done; But it ...
0
votes
2answers
118 views

How to SSH multiple service with a for in SHELL?

I would like to access some server via SSH, run some commands and exit. Do this for lots of servers. I know I can do this for one machine only, with this script : ssh **IP** << EOF chown -R ...
1
vote
2answers
2k views

How create a service correctly?

Here it's what I do: 1) create an user some_deployer 2) then create a folder to script like /company/script/<service name> 3) in this folder I create the start.sh and stop.sh scripts and ...
2
votes
2answers
390 views

Is it possible to have scripts that trigger whenever an IM is received in Microsoft Lync?

I've just upgraded to Lync 2013, and I'm considering using it instead of Pidgin+SIPE. One of Pidgin's many nice features is Growl integration... and I would miss that. There are no Growl plugins for ...
1
vote
0answers
62 views

allowing timeouts for commands that have no timeout option, where `IFS=$'\n'`

In the lines below, which I added to my copy of Apple's sysdiagnose script: wherever a timeout is already scripted, it is effective I must add timeouts in two areas, but I don't know how to do so. ...
2
votes
2answers
403 views

Bash/expect script to log in via ssh and port knocking. SSH Keys not possible

My login server is behind a firewall that uses port knocking to allow entry. The login-flow is Enter in port knocking command. This requires my external IP to be entered. When prompted, enter in my ...
0
votes
1answer
386 views

How do I create a “here document” within a shell function?

I'm working my way through William Shotts Jr.'s great The Linux Command Line on my Mac OSX 10.7.5 system. 90% of the linux that Shotts covers is close enough to Darwin that I can figure out or GTEM to ...
0
votes
2answers
135 views

Shell script: Copy folder with a new name

I'm trying to write this shell script to create in the parent directory a copy of the folders found in the current directory. So far, I wrote this: for folder in *; do mkdir ../$folder; done ...
1
vote
1answer
397 views

BASH script not working on windows

So I made a bash script, that works on MAC perfect, but on windows even with cygwin and CURL installed doesn't work, here is the errors that I'm getting $ ./r.bash Project name: imiodrag ': not a ...
1
vote
0answers
35 views

Scripting the way firefox starts

In Windows 7, is there any way to script the websites that are opened whenever I open Firefox based on certain criteria? For example, if it's Thursday, load a certain website as my homepage, but only ...
1
vote
1answer
198 views

Script to start computer in Safe Mode and then restart it in Normal Mode?

My PC has Windows 7 and over time it refuses to go beyond the Windows logo animation unless I start it up in safe mode first, and then restart in normal mode. That's quite a chore to do everyday and ...
1
vote
1answer
305 views

script for auto adding routing table entries

I work for a company that has a lot of remote agents that use mac's. Before we will move them to mountain lion, we had to address the VPN issues we were having. We deal with a lot live media and ...
0
votes
1answer
59 views

Diff between files in different directories

I have the follow directory structure ./goodboys/a.txt ./goodboys/b.txt ./badboys/a.txt.boy ./badboys/b.txt.boy I am using zsh. I want to diff all *.txt in goodboys with *.txt.boy in badboys. I am ...
0
votes
1answer
651 views

How to remove blank lines in .txt files

I want to change a text file's format, removing all blank lines. How can I do that? (2) 5. The function of the condenser is to: a) vapourise the liquid refrigerant b) change ...
0
votes
1answer
422 views

How to prompt (gui) and use root password on a script?

I would like run a script of mine that need some root privilegies on a gui way. For example, a simple script could be: #!/bin/sh clementine sudo shutdown -h 00:00 The first line opens the ...
0
votes
2answers
60 views

Has Anyone Made a Program to Manage Scripts (Non-CM)? Recommendations?

I find myself often writing shell scripts in Linux and losing track of them over time. What I would love is a program that stores a copy of the script, along with a descriptive note I write at the ...
5
votes
2answers
3k views

Recursive unrar of several folders

I have several RAR archives spread around multiple directories but all under a particular root folder on my Debian based NAS. Could someone help me write a simple script that would recursively go into ...
0
votes
2answers
106 views

Script that deletes a directory but doesn't delete marker files on linux

I got a script running and its cool and all. Any idea how to make this script run under just 1 level of subdirectory? #! /bin/bash #This will delete the sub-directories of a specific directory when ...
5
votes
2answers
2k views

How to extract a complete list of extension types within a directory?

Within a directory, and recursively within it's sub-directories, meaning every directory within a directory is processed, how do I compile a complete list of unique extensions within the directory? ...
1
vote
1answer
144 views

Identifying a file with “file” in a shell script?

I'm currently writing a shell script that needs to be able to identify the actual type of files (not their extensions) with the unix "file" utility. However, that tool outputs human readable text ...
1
vote
3answers
2k views

shortcut for opening cmd.exe at a certain location

How can I create an icon\shortcut to a script that opens cmd.exe command prompt at a certain location on a certain drive under Win7?
1
vote
0answers
1k views

Macintosh OS X Logout Script

I am working on a project where I need to implement a logout script on some Macintosh computers. I have read the following Create a logoff script/task for Mac OS X article and found that while it is ...
0
votes
0answers
168 views

CScript Terminates before completing task

I am using the below with mods but ziping several Gb of info the last command is Wscript.sleep 2000. I have extended this to 20,000 and 200,000 but I use the script vor various diferent sizes. Is ...
12
votes
4answers
8k views

Should I put *.sh and *.rb file extensions on all my scripts?

I have a bunch of hand-rolled executable scripts in my $HOME/bin directory. Some are written in bash, some in Ruby. All of them have the shebang line at the top telling the shell what interpreter to ...
2
votes
1answer
78 views

Linux copy parameters to other program

I have made a script ocrun param1 param2 that calls another program like oprun param1 .. i would like somehow param3 and all following (parami) to be copied to oprun.. ex: `ocrun param1 ...
1
vote
1answer
601 views

Automatically create snapshot before launching VirtualBox VM?

Does anyone have a script or know how to write one to automatically take a snapshot of a VM before launching it for use?
0
votes
2answers
232 views

How do can I update a Form using shell/bash script on Linux?

I am wondering is it possible to echo values like below described? The situation is - there are too many "doc" files named like "PLCI507_01234567.doc", and there is a Form in a text file named ...
4
votes
2answers
266 views

Use of '#!' in *nix scripts

In many Apple/Unix scripts I see stuff preceeded by '#" which as far as I know means it is a remark. However often you see shell calls as below (the line with #!). ## Setting a default route ...
1
vote
1answer
843 views

Shell script to rename multiple files from their parent folders name

I have a file structure like this: 00000010 000000001.file1 000000001.file2 00000020 00000003.file1 00000003.file2 00000003.file3 ... So there are folders with 8-digit names containing one ...
11
votes
2answers
52k views

How do I concatenate strings in a bash script?

How can I concatenate strings and variables in a shell script? stringOne = "foo" stringTwo = "anythingButBar" stringThree = "? and ?" I want to output "foo and anythingButBar"
2
votes
1answer
892 views

Bash auto-delete script

I'm looking for a bash script that would auto-delete oldest folders (lets say last 3) in a directory when the available space drops below X gigs. Any ideas? *Ive red related posts but since I don't ...
0
votes
2answers
212 views

What is wrong with my Linux installation if my script won't run with the following error messages

Trying to run some .sh scripts in a very cut down Ubuntu installation, but I'm getting messages of the following style: ./my_script: 61: [[: not found ./my_script: 61: ==: not found ./my_script: 61: ...
4
votes
3answers
4k views

How to download this webpage with wget?

I want to download this webpage: http://forum.ubuntu-it.org/ but it require username and password. So I have used this wget --save-cookies cookies.txt --post-data ...
0
votes
2answers
2k views

Open new terminal from script to get user input and use input in script

Is it possible from a background shell script to open a new terminal (xterm, gnome-terminal, whatever), get some user input, close the newly opened terminal and use the data that was input?
0
votes
5answers
1k views

FTP too slow when sending many small files

I often have to transfer 4000 small files to a remote server (around 20 MB of data), which I currently only have FTP access to. This operation takes 30 minutes but if I were to send one file sized 20 ...
1
vote
3answers
1k views

Framework for interactive shell script (bash)

My current project runs a tests system on a linux box (with 9 active screens) The whole team are familiar with how to kick off a test &c. but less familiar with the commands for checking ...
3
votes
3answers
740 views

bash shell script which adds output of commands

Let's say I have a command called foo which prints a number to the screen when called: $ foo 3 Let's also say I have another command called bar which prints another number to the screen when ...
0
votes
1answer
218 views

find and mail if changes has occured, unix

The following script runs and finds if any new suid has been changed, and redirects the output to a file. I want to add a mail command in the script, that will send mail to [email protected] If ...
11
votes
3answers
4k views

How do I launch a bash script from Finder in OS X?

How do I launch a bash script from Finder in OS X? I'm OK working at the CLI, but my little script is not so loved by my GUI-bound colleagues.