Hi all,
I want to write a Unix shell script that will do various logic if there is a string inside of another string. For example, if I am in a certain folder, branch off. Could someone please tell me how to accomplish this? If possible I would like to make this not shell specific (i.e. not bash only) but if there's no other way I can m...
I need to write some scripts to carry out some tasks on my server (running Ubuntu server 8.04 TLS). The tasks are to be run periodically, so I will be running the scripts as cron jobs.
I have divided the tasks into "group A" and "group B" - because (in my mind at least), they are a bit different.
Task Group A
import data from a file ...
I need a shell script that deletes 1000 rows from a massive database until there is no more rows left
It is very simple, but i am very weak in shell scripting, and the many tutorials online offer extremely similar, but different nuances in syntax
UPDATE:
Would it be possible to get some sample code?
I need to delete 1000 rows at a t...
When using the programmers text editor vi, I'll often using a wildcard search to be lazy about the file I want to edit
vi ThisIsAReallLongFi*.txt
When this matches a single file it works great. However, if it matches multiple files vi does something weird.
First, it opens the first file for editing
Second, when I :wq out of the fil...
Is there a way that lets me run a shell script, and display the output in an NSTextView? I do not want any input from the user to the shell script at all, since is is just called to compile a buch of files. The shell script part works fine so far, but I just can't figure out how to run it and show the output in an NSTextView. I know a sh...
Using Solaris
I have a monitoring script that uses other scripts as plugins.
Theses pugins are also scripts which work in difffernt ways like:
1. Sending an alert while high memory uilization
2. High Cpu usage
3. Full disk Space
4. chekcking the core file dump
Now all this is dispalyed on my terminal and I want to put them in a HTML f...
In a bash script how do I echo all shell commands called and expand any variable names?
For example, given the following line:
ls $DIRNAME
I would like the script to run the command and display the following
ls /full/path/to/some/dir
The purpose is to save a log of all shell commands called and their arguments. Perhaps there is a bet...
As stated in the title, I have to write a simple script which should perform some typical agenda's functions. The script must use crontab.
The functions are:
Creating a new appointment
Edit an existent appointment
Delete an appointment
List the appointment
I really don't have a clue how to do this, can you help me with some hint? May...
I want to iterate over each line in the output of ls -l /some/dir/*
Right now I'm trying: for x in ls -l $1; do echo $x done, however this iterates over each element in the line seperately, so i get
-r--r-----
1
ivanevf
eng
1074
Apr
22
13:07
File1
-r--r-----
1
ivanevf
eng
1074
Apr
22
...
Tcpflow outputs a bunch of files, many of which are HTTP responses from a web server. Inside, they contain HTTP headers, including Content-type: , and other important ones. I'm trying to write a script that can extract just the payload data (i.e. image/jpeg; text/html; et al.) and save it to a file [optional: with an appropriate name an...
I have two processes: a server that should be run in background, but starts serving requests after a delay, and a client that should be started when server is ready. The server prints line containg "Acceptin connections" to its stderr when ready (server stderr is redirected to a file when running it in background).
How to delay putting...
Hi,
I've been writing some shell script and I would find it useful if there was the ability to halt the execution of said shell script if any of the commands failed. See below for an example:
#!/bin/bash
cd some_dir
./configure --some-flags
make
make install
So in this case if the script can't change to the indicated dire...
i use cron tab with command
wget http://www.mydomain.com/page.php
to run one of my pages in server. It works, but problem is output is sved with names
page.php,
page.php1,
page.php2,
page.php3
etc.
Can i run the page using wget without sving output
...
Hi,
I want to do grep texts files inside a rar without extracting the rar file to disk, I tried a couple of combinations with pipes however it didnt work i tried for example
unrar e myrar.rar | grep mysearchedline
however it actually opened it to disk, I don't want to open it to disk, I don't have enough space for it to be opened (...
I want to create a command-line script for Cygwin/Bash that logs into a site, navigates to a specific page and compares it with the results of the last run.
So far, I have it working with Lynx like so:
----snpipped, just setting variables----
echo "# Command logfile created by Lynx 2.8.5rel.5 (29 Oct 2005)
----snipped the recorded keyst...
I am relative new to shell scripting and sed. I need to substitute a pattern, globably, but I also need to remember (or save) part of the pattern and use it later in the same substitute command. The saved pattern will be varible, so I need to use a wild card. For example,
input message=trt:GetAudioSourcesRequest/>
and I want to end up...
Hi,
I have a fairly simple bash shell scripting problem.
I want to sed a piece of text and then assign the result of the sed to a variable.
#!/bin/bash
MOD_DATE=echo $(date) | sed 's/\ /_/g'
echo $MOD_DATE // should show date with spaces replaced with underscores.
I have tried the above and it doesn't work. Can anyone point out what...
Hi, I'm trying to test whether a directory path exists when a file is passed to my script. I use dirname to strip and save the path. I want my script to run only if the path exists. This is my attempt below.
FILE=$1
DIRNAME=dirname $FILE
if [ -z $DIRNAME ] ; then
echo "Error no file path"
exit 1
fi
But this doesn't...
Hi,
I'm trying to print arguments passed to a ./configure script. Calling 'echo' on $BASH_ARGV will just print the last set of arguments. For example if I run:
./configure --enable-foo --enable-bar
echo $BASH_ARGV will print only "--enable-bar"
How do I print all the arguments? Thanks!
...
Greetings!
I have a text file with parameter set as follows:
NameOfParameter Value1 Value2 Value3 ...
...
I want to find needed parameter by its NameOfParameter using regexp pattern and return a selected Value to my Bash script.
I tried to do this with grep, but it returns a whole line instead of Value.
Could you help me to find ...