Tagged Questions

It is often considered a simple domain-specific programming language. Typical operations performed by shell scripts include file manipulation, program execution, and printing text.

learn more… | top users | synonyms (1)

0
votes
1answer
19 views

Batch script for creating tasks?

Is there a way to create a batch script to add tasks to the Windows Task system? I need to setup 2-3 tasks per system but I want to be able to run a script to do it.
1
vote
2answers
56 views

Script won't stop cleanly

I wrote this small shell script to start a gunicorn WSGI server for my django app. I'm running it on Ubuntu 12.04, and the script starts cleanly and runs like it's supposed to. The problem is that ...
0
votes
1answer
86 views

Automatically close Terminal after script execution

How do I automatically close the Terminal after script execution? #!/bin/bash cd ~/Desktop/sh-scripts/ ./start.sh & // ??? how to close Terminal
1
vote
2answers
66 views

Test if a package is installed in APT

I want a shell script method to test/report if a package is installed. I don't need details, only boolean return to set logic flow. I looked at Find if a package is installed, but dpkg returns complex ...
0
votes
1answer
26 views

bash script working, but outputting only 1 file

Attempting to have this script run through a directory and perform the operation on every file with the .tmp.tcx extension, so if I had 3 unique files with ${b}.tmp.tcx, I'm hoping for 3 unique files ...
1
vote
4answers
84 views

Get PID of process started in screen by su

i have a simple script that starts quassel-core in a screen session as different user! The script is: #!/bin/sh su ircc -c 'screen -dmS quassel /home/ircc/quassel/quassel-core' I want to start and ...
0
votes
1answer
41 views

Bash Script for loop that is breaking lines up instead of using the whole line

I am writing a very simple script and I'm getting stuck on something stupid. Basically I have text file in which each line is comprised of 3 words separated by a space. When you cat the file it ...
0
votes
1answer
28 views

Append line length at end of each line

Given input: tree branch the desired output is tree 4 branch 6 What is a *nix available command that does this?
1
vote
3answers
57 views

Script for cutting videos based on edit list

I have a bunch of game footage from my soccer team's season and I've assigned each of my teammates one game to watch and write down the time intervals where highlights occur. Now instead of having ...
0
votes
1answer
69 views

how to extract string from text using shell script

i have the following text A shell script is a (script) written for "the shell", or command line interpreter, of an operating system. The shell is [often] considered a "simple" domain-specific ...
0
votes
1answer
55 views

ubuntu shell script checking for

I'm looking for something like this: if [ "`python2.7 -V`" == "Python 2.7" ] ;then echo "woh" fi inside the if statement ... check to see if running the command $ python2.7 -V returns the ...
1
vote
2answers
141 views

Avoid creating multiple files with wget

I use wget to call a link every 10 seconds like this: #/bin/sh while true; do wget http://www.some.random.link/to/some/PHP/script sleep 10 done This produces empty files called ...
0
votes
0answers
35 views

Set .command file to open with a certain Terminal settings profile?

I have a set of .command files I use for various utility purposes, and in order for them to work well, I have configured a Terminal settings profile, which controls things like colors, exit actions, ...
0
votes
1answer
75 views

ShellScript:dialog inputbox

Somehow to interact with user using shell in Linux you can use dialog. my question about dialog --inputbox where you let user to enter a string as an answer to a question then you can redirect the ...
0
votes
1answer
170 views

I get “lost connection” error while using ssh and scp

mySCP="scp -q -o StrictHostKeyChecking=no -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o HostbasedAuthentication=no" rm -Rf /tmp/logdata mkdir /tmp/logdata $mySCP -r ...
3
votes
1answer
163 views

How can uptime be used to trigger an action?

I want to write shell or perl code which would give me notification after x days. Basically on SUSE Linux server, there is reboot required after 208 days, else the system would freeze. This is known ...
0
votes
2answers
53 views

Generate new file with specific structure from text file

On Linux I have the file orig-file.txt. This file include 4 fields now, but they could be less or more (this file is generated by other application). What is the best option to translate the ...
1
vote
1answer
50 views

Pop current directory until specific file is found

I'm interested in writing a script with the following behavior: See if a file, build.xml, exists in the current directory, if so run a command supplied through arguments to the script. If not, pop ...
0
votes
0answers
192 views

Fedora 16 seems to need a different auto logon auto start shell script?

Im looking for auto root login shell then when logged in auto start a script. Looks like Fedora 16 use very different approach than other Fedoras.
0
votes
2answers
38 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 ...
0
votes
0answers
52 views

Test if connection can be made to Samba share

I need to write a web app that tests if a user has permission to access a Windows share via Samba. The idea is that there is a windows share at some location on my corporate domain, where only ...
2
votes
1answer
93 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 ...
2
votes
2answers
184 views

Shell script to login from an SSH central

We have an SSH server that acts as an entry point to our other servers. Once I login here via ssh, it'll prompt me to key in what server, port, username, and password that I will be using. Is there ...
0
votes
3answers
218 views

Unzipping files using Shell Script

All, I have an app where user picks up a zipped folder which a shell script unzips and then renames for processing. The zipped folder will always have the following naming convention: ...
0
votes
2answers
37 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 ...
0
votes
1answer
210 views

Get the process id from ps -ef grep (or Stop an application before removing it)

I have an rpm and I want on uninstall to check if my application is running and if it is stop it before running the uninstall. My service runs under a specific user. How can I do this using bash in ...
1
vote
1answer
72 views

Generate a list of files by piping output of find command into another find command?

I need to generate a list of files for use in a shell script. The list should be all files (in a specified directory) that are hardlinked. I want to replace the hardlinks with symlinks. (Obviously, ...
0
votes
1answer
32 views

ls link count seems incorrect - how do I ensure I'm not deleting the inode contents?

ls -lai on a file gives me a link count of 2: 16508 -rw-rw-rw- 2 ... Then looking for all the filenames returns only one: find "$dir" -inum 16508 This lists only the original file, not two. ...
1
vote
2answers
40 views

How to automate changing my ip?

I am very new to OSX. I will use my MBP at work and home. I would like to be easily able to switch my ip when changing location. Thus far I have dabbled with the automator, hoping to do something ...
0
votes
1answer
73 views

How to improve this bash shell script for turning hardlinks into symlinks?

This shell script is mostly the work of other people. It has gone through several iterations, and I have tweaked it slightly while also trying to fully understand how it works. I think I understand it ...
0
votes
2answers
65 views

Can running a script for many days harm my computer?

I have made some BASH scripts which take 24 to 48 hours to completely run on my netbook. They mostly make use of sed and awk and are constantly editing some files. If I run these for such a long time, ...
1
vote
3answers
165 views

How to script a database migration using an SSH tunnel?

I am trying to create a sync.sh script that coordinates with our less-than-ideal version control for our website. This script will migrate a live copy of the database to our development environment ...
1
vote
1answer
204 views

Shell script commands not executed after SSH login until exit from SSH

I'm new to shell scripting and I tried to have a script ssh into another machine and perform some commands. I have the public/private key set up so I'm not prompted for a password when I ssh into the ...
0
votes
0answers
121 views

Shell script to find and delete a text pattern from .java files

I want to delete a catch block from java files. I need a script which can search the catch block and delete it. I have hundreds of files with the following code which needs to be removed from the ...
0
votes
2answers
81 views

How to replace a command with the result of another in linux?

I want to create a command which uses the result of another like this: JNLP_FILE='find . -name viewerApplet.jnlp' cp ${JAR_FILE} ../../sign-jar/$PROFILE/ But I don't know how to execute the find ...
2
votes
1answer
53 views

How do I tell an app that the home folder is located somewhere else?

Here's the basic script from a batch file. I'm trying to do something similar to this, but on Linux that would tell Minecraft(Java) that the home folder was located somewhere else (like a flash ...
0
votes
1answer
100 views

How to continuously execute an application with cmd with Windows Server?

this is my requirement: I need to execute an endless script continuously. The script never ends by itself but if someone closes it I need to launch it again (can be a delay between the close and the ...
0
votes
3answers
145 views

Shell script to get the response from server

We are testing our server. I am a beginner to shell scripting. I need an bash shell script, to read a text file having URLs, query each URL to the server and check whether the application server ...
1
vote
1answer
151 views

shell scripting grepping for pattern and then echo message

I have a file which has the below pattern ================================================= 4601 -- it means completed 4602 -- it means failed 4603 -- it means timed out ...
2
votes
1answer
86 views

How to search *upwards* for file? (reverse find)

I'd like to search "upwards" for a file in shell script, e.g. check $PWD, then $PWD/.., then $PWD/../.., etc. until hitting the root. Before I go and roll my own, is there some builtin bash/zsh/find ...
2
votes
1answer
90 views

Why use parens instead of backticks for executing a command 'in situ'?

I have recently started to shift my shell scripting from utilizing backticks to parens to execute a command in situ and use the results in something else. Eg: for line in `cat file` do echo ...
0
votes
1answer
80 views

grep + match quantity and numbers

with the following command I can verify/match if param have numbers or "." param=2.3.1 echo $param | grep [0-9][.] but what I need to add in my syntax in order to verify also if I have at ...
1
vote
2answers
154 views

Can I encrypt a username password combo before using it with cURL?

I'm making a shell script that reached out to a web service with basic auth. I don't want to have to put in my username and password every time the script runs, but I also don't want to have the combo ...
0
votes
0answers
121 views

linux + ssh limitation + ssh at the same time from multiple machine to one machine

the following script "testssh.ksh" proves that ssh have some problems when we try to perform ssh from multiple machines on the same time in fact the target of this script is to verify the file ...
0
votes
1answer
38 views

Execute Script when leaving a window

is it possible to execute a Script (Applescript/Shellscript) when I leave a window (and when I switch back to it)? What I want to do: I want to pause my VM when I leave the VM-Window (vmrun pause ...
1
vote
1answer
137 views

solaris + egrep command syntax not work

my target is to match snmpmanager string from /etc/hosts file in Solaris machine I don’t get any match output from the following command (but snmpmanager already defined in host file) why?? egrep ...
1
vote
1answer
168 views

How can I write a cron job to archive my log files every night?

I assume this is relatively easy but my shell scripting isn't that great so I'm hoping to get some help. I have a task which runs every hour and appends its output to a log file. I'd like to move ...
-2
votes
0answers
48 views

Create an executable from a shell script in OS X [closed]

Possible Duplicate: Can I create a configuration file for a shell script? I need to create an executable from shell (.command) in OS X, with parameters. Example: backup -s1 -s1 is ...
1
vote
4answers
139 views

Learning Shell Script, What's Next? [closed]

I've had finished learning "Shell Script" in Linux so I'm now intermediate near advanced level but I can't guess how can I use this scripting language to make things/tiny programs! Just as having the ...
0
votes
1answer
106 views

usermod + awk invalid syntax

I have been trying to write a command (Solaris server) that adds a user to a specific group. It's a pretty long command so I'll post the whole command here and then break it down. USER=myUser ...

1 2 3 4 5 6