Here's a very simple, probably duplicate (sorry - I have tried searching) shell scripting question.
What's the correct syntax to set DATA_DIR as a subdirectory of WDM_DIR, in the script below? (Line 2.)
WDM_DIR='/Users/ap257/wdm/wdm'
DATA_DIR=$WDM_DIR+/wdm/pylons_data/getdata/
cd $DATA_DIR
The point is that people can change WDM_DIR ...
Hello!
I want to write a shell script to get an image from an rss feed.
Right now I have:
curl http://foo.com/rss.xml | grep -E '<img src="http://www.foo.com/full/' | head -1 | sed -e 's/<img src="//' -e 's/" alt=""//' -e 's/width="400"//' -e 's/ height="400" \/>//' | sed 's/ //g'
This I use to grab the first occurence of an image UR...
I'm trying pipe the output of an awk command through more than one command at once in a Bash shell, following my knowledge I'm coming up with this:
awk '$13 ~ /type/ {print $15}' filename.txt | (wc -l || sort -u)
I want the result of the awk command to be both counted AND sorted, how can I accomplish that?
Even with && command it does...
I have a command which when executed gives following outputs
$ cleartool pwv
Working directory view: abhijeet_trialProj_r2.4-phase1_ba_abhijeet_branch
Set view: abhijeet_trialProj_r2.4-phase1_ba_abhijeet_branch
$ cleartool pwv
Working directory view: ** NONE **
Set view: abhijeet_trialProj_r2.4-phase1_ba_abhijeet_branch
$ ct pwv
Wor...
Hello,
I'm totally new to scripting but I got sick and tired of compiling my native code for Android manually so I wrote a little .sh script and a .bat file to run this script in cygwin.
Both files are placed in the root of a project, in the .sh file the NDK directory is set and then by running the .bat file I compile my native code.
T...
How can I send some specific number of, say 1000, messages (echo) per second to a file by a shell script?
i.e. I want to echo 1000 such messages ("hi") per sec to a (tmp) file.
echo "hi" >> tmp
...
I have a Perl script which downloads a large number of files from a remote server. I'd like to avoid hammering the server, so I'd like to avoid downloading a file if it hasn't been modified since my last check. Is there a good way to do this, either in Perl or with a shell script?
Can I get the server to send HTTP 304 rather than HTTP ...
I have a directory with multiple files in the form of:
file001_a
file002_a
file002_b
file003_a
Using a shell script, I was wondering what the easiest way would be to list all files within this directory that have duplicates in the first 7 letters; ie the output above would be:
file002_a
file002_b
any help would be much appreciated!...
The Unix cut command takes a list of fields, but not the order that I need it in.
$ echo 1,2,3,4,5,6 | cut -d, -f 1,2,3,5
1,2,3,5
$ echo 1,2,3,4,5,6 | cut -d, -f 1,3,2,5
1,2,3,5
However, I would like a Unix shell command that will give me the fields in the order that I specify.
...
Here is a sample string . I would like to get the output from this in the specified format.
String:
/vob/TEST/.@@/main/ch_vobsweb/1/VOBSWeb/main/ch_vobsweb/4/VobsWebUI/main/ch_vobsweb/2/VaultWeb/main/ch_vobsweb/2/func.js
filename;path to file
func.js;VOBSWeb/VosWebUI/VaultWeb/func.js
The filename is listed at the end of the whole st...
Hello Gurus
I've been trying to let a php file call a shell script to run a jar file on Ubuntu and put an output on the screen or at least on a file but it doesn't seem to work at.
The script itself run from terminal does the work but not the php file.
here is the php file
$output=shell_exec('callablescript --import b57b06bb-36d8-de6c...
I am writing a short shell script which calls 'make all'. It's not critical, but is there a way I can suppress the message saying 'nothing to be done for all' if that is the case? I am hoping to find a flag for make which suppresses this (not sure there is one), but an additional line or 2 of code would work too.
FYI I'm using bash.
Ed...
can I change/su user in the middle of a script?
if [ "$user" == "" ]; then
echo "Enter the table name";
read user
fi
gunzip *
chown postgres *
su postgres
dropdb $user
psql -c "create database $user with encoding 'unicode';" -U dbname template1
psql -d $user -f *.sql
...
I need to run this command
psql -c "create database $var with encoding 'unicode';" -U edumate template1
from the script under different user. The su syntax is su postre -c 'some command' so there are another quotes required. Also please note that the psql command has $var variable inside.
so 'some command' = psql -c "create database ...
hii,
i want to edit she bang line #!/bin/bash line on the top of files in all the files with .sh extension how it done bye scripting .
thanks
...
Hello,
I want to add a line in the crontab (on my local machine) which will run every five minutes. My problem is the command I am going to use requires sudo :
sudo indexer --config /usr/local/etc/sphinx.conf --all --rotate
Is there a way I can run the command without using sudo and without prompting for password ?
Thanks!
...
I've never done shell script before and now I'm running into a simple problem...
I have a for loop which executes every time the run.sh script. To see how far the script has already run I want to print e.g. every 5000 the actual index.
$counter = 0
for (( i = 0 ; i <= 5000; i++ ))do
if ($i = $counter); then
echo "$c...
For Ex :
echo "adsa " >> a.txt
echo "asdad " >> a.txt
in my file
adsa
asdad
But i am looking for
adsa asdad
...
So I'm trying to execute a shell script which produces a lot of output(in 100s of MBs) from a Java file.
This hangs the process and never completes.
However, within the shell script, if I redirect the output of the script to some log file or /dev/null Java file executes and completes in a jiffy.
Is it because of amount of data that the...
Example: I have a file: FILENAME.EXT and would like to extract FILENAME without the .EXT
I want to be able to use the extensionless filename for a command which only accepts filenames without its extensions. I have a utility called BCHECK which accepts as its argument a filename with no extensions. Using BCHECK *. does not work because a...