i need to make a graph with numeric values in a time period, the values represent online users in a web page.
the script will be exectued with cron every 30 mins and the needed html file will be downloaded with wget. but there are some yet unanswered questions & problems:
-i need to get just the numeric value from html code (but grep r...
Could someone take a look at this code and find out what's wrong with it?
#!/bin/sh
while :
do
echo " Select one of the following options:"
echo " d or D) Display today's date and time"
echo " l or L) List the contents of the present working directory"
echo " w or W) See who is logged in"
echo " p or P) Print the pre...
Is there a way to embed the last command's elapsed wall time in a Bash prompt? I'm hoping for something that would look like this:
[last: 0s][/my/dir]$ sleep 10
[last: 10s][/my/dir]$
Background
I often run long data-crunching jobs and it's useful to know how long they've taken so I can estimate how long it will take for future jobs....
I have a Bash script that basically initializes an application and sets parameters. One of these parameters is the location to OpenOffice. Now OpenOffice doesn't set an environment variable when you install it.
What is the best method of finding the location of an application installed and caching that information so you don't have to d...
In the same thread as this question, I am giving this another shot and ask SO to help address how I should take care of this problem. I'm writing a bash script which needs to perform the following:
I have a circle in x and y with radius r.
I specify resolution which is the distance between points I'm checking.
I need to loop over x and...
I am looking for a shell script which scans a direcotry and all its subdirectories for .php and .phtml files. Within these files, I am looking for $this->translate('') statements (also $this->view->translate('')) and I want to save the content of these statements in a textfile.
The problem is, that there are several different types of t...
I am using find in a Bash script. How can I modify that code to include a specific directory under 'bin' , ie './bin/php/' (while still ignoring all other sub-directories of 'bin')?
Current code:
find . -name '*.php' \
-and ! -path './bin/*' \
...
I have a variable that contains the following space separated entries.
variable="apple lemon papaya avocado lemon grapes papaya apple avocado mango banana"
How do I remove the duplicates without sorting?
#Something like this.
new_variable="apple lemon papaya avocado grapes mango banana"
I have found somewhere a script that accompli...
I have bash script which works well but when I send it back with nohup script &
and close my terminal session then it's not working correctly. It only works well within my terminal session open.
What could be possible reasons which affects my script run not correctly without my terminal session? Could it be one of the terminal variabl...
I came across "$$" expression in shell script, something like this
TFILE=$$
Can anyone tell me its meaning?
...
I'm rather new to bash scripting, and Google isn't as useful as I'd like for this. I'm just playing around with a little password entry program in my .bash_profile and have something like this:
read PASSWORD
if $PASSWORD != 'pass'; then
echo "wrong. exiting"
exit
fi
Unfortunately, this doesn't work. I get these errors (darwin...
how to Enter data from keyboard in shell programming ?
some command similar to scanf in c
...
Please tell me what is the difference in bash shell between launching a script with
./script.sh and . ./script.sh?
...
I want to extract the URL from within the anchor tags of an html file.
This needs to be done in BASH using SED/AWK. No perl please.
What is the easiest way to do this?
Thanks a lot.
...
I want to put a quick "are you sure?" prompt for confirmation at the top of a potentially dangerous bash script, what's the easiest/best way to do this?
...
Can anyone tell me what I'm doing wrong here?
#!/bin/sh
if [ $# = 0 ]
then
echo "Usage: $0 <filename>"
exit 1
fi
sum=0
count=0
while [ $0 != 0 ]
do
sum="$sum"+"$2"
count="$count"+ 1
done
if [ "$count" != 0 ]
then
avg="$sum"/"$count"
printf "Sum= $sum \n Count= $count \n Avg= $avg"
exi...
Here i have got various inputs from keyboard and checked these validations
Book_id must be unique.
Subject code can only be either UNIX or C.The Shelll i work is bash
i got the following errors
./test.sh: line 5: declare: `=0': not a valid identifier
/test.sh: line 13: unix: command not found
./test.sh: line 92: syntax error: un...
Is there a way in bash on a mac to draw a pretty info box that displays a simple message like "please save all files to /Users/......"
...
My Script currently takes the first user returned from "users" and in testing it worked fine but once i turned it into a login hook it couldn't pickup the user properly.
Is there a way to pickup the user that is logging in?
Using $USER doesnt work either
Ive tried using "/usr/bin/logname" to get the username and that only returns "roo...
a question following making-the-subversion-revision-number-visible-in-my-r-scripts
R CMD build PKG creates a file named as Package_Version.tar.gz according to the fields in DESCRIPTION.
not only isn't the strictly sequential numbering coming from svn very practical here, but its $REV: number $ format does not respect the number.numb...