I'm making a shell script and I want to know if it's possible to write directly to the command line when the script is executed ?
Example :
user@localhost:/home/user$./script.sh
... output
... another output
... another output
... last output
user@localhost:/home/user$I want to write here on the command line
I don't want to "echo" so...
I am having trouble writing a simple if statement in a BMC Bladelogic NSH shell script.
My question is what is the proper syntax to write a statement that compares two strings to see if they are equal or not. I understand how an if statement works the problem seems to be syntax.
An example of what I have tried is as follows where $PL...
Hi, I'm trying to setup PHP & SQLite on my mac with by following this page: http://developer.apple.com/mac/articles/internet/phpeasyway.html. The code posted on the site is supposed to be run in a command script but I don't know how to make that happen. I've tried making a bash script and an applescript but both of those give errors. Any...
I want to append something at the end of a certain line(have some given character).
For example, the text is:
Line1: I just want to make clear of the problem
Line2: Thanks to all who look into my problem
Line3: How to solve the problem?
Line4: Thanks to all.
Then I want to add "Please help me" at the end of
Line2: Thanks to all...
I need to extract some information from a log file using a shell script (bash). A line from the log file usually looks like this:
2009-10-02 15:41:13,796| some information
Occasionally, such a line is followed by a few more lines giving details about the event. These additional lines do not have a specific format (in particular they d...
I am on Mac's OS 10.6, and I am trying to learn a thing or two about shell scripting. I understand how to save a shell script and make it executable, but I am wondering what I can do or where I can save the file to make it global (that is, accessible no matter what folder I am in).
For example, if I save a .sh file in the /Users/usernam...
I have a cshell script that is something like this:
`netstat -ap | & grep tcp | grep myprocess | awk '{print $4}' | awk 'BEGIN { FS = :"}{print $2}'`
This is how it works
1.
$ netstat -ap | & grep tcp | grep myprocess
tcp 0 0 *:1234 *:* LISTEN 8888/myprocess
2.
$ netstat -ap | & grep tcp | grep myprocess | ...
I've mastered the basics of Bash compound conditionals and have read a few different ways to check for file existence of a wildcard file, but this one is eluding me, so I figured I'd ask for help...
I need to:
1.) Check if some file matching a pattern exists
AND
2.) Check that text in a different file exists.
I know there's lots of way...
I recently installed jEdit on my Mac OS 10.6 system. I would like to be able to run jEdit in the terminal as I would emacs, i.e. 'emacs FILE.NAME'. My plan was to write a script jedit.sh containing...
touch $1
open -a /Applications/jEdit.app $1
...where the argument is the filename. Strangely, jEdit is opened but only with the default...
hi
I
write the following syntax (part of my ksh script)
to check if the first word of LINE=star
and the second word is car
[[ ` echo $LINE | awk '{print $1}' ` = star ]] && [[ ` echo $LINE | awk '{print $2}' ` = car ]] && print "match"
I need other simple smart and shorter solution then my syntax.
from awk,perl or sed(if ...
hi
is it posible to print the value NUM (100) , while I must use only ' and not "
# NUM=100
# PARAM='some text $NUM'
# echo $PARAM
some text $value
the right print
some text 100
...
Hi there,
I wanted to get the community's feedback on a language choice our team is looking to make in the near future. We are a software developer, and I work in a team of Oracle and SQL Server DBAs supporting a cross platform Java application which runs on Oracle Application Server. We have SQL Server and Oracle code bases, and supp...
I am writing a simple shell script that fetches output from one command uses it in another.
app=$(./twiddle.sh -u $1 -p $2 query jboss.web.deployment:* | grep $3)
doop=$(./twiddle.sh -u $1 -p $2 invoke jboss.system:MainDeployer $4 $app)
++ ./twiddle.sh -u admin -p password invoke jboss.system:MainDeployer stop $'jboss.web.deploymen...
I have a ksh script that generates a long, random string using /dev/urandom and tr:
STRING="$(cat /dev/urandom|tr -dc 'a-zA-Z0-9-_'|fold -w 64 |head -1)"
On the Linux and AIX servers where I used this it resulted in 64 characters of upper and lower case alpha chars, digits, dash and underscore characters. Example:
W-uch3_4fbnk34u2nc0...
I work in a research group and we use the PBS queuing system. I'm no PBS master, but I wanted to script a search for if a job was running. To do this I first grab a string of all the jobs by using the results of a qstat call as my argument to qstat -f and then taking the detailed list of all jobs and searching it for the submitted file...
I have a shell script that launches a Maven exec:java process -
exec mvn exec:java -Dexec.mainClass=... -Dexec.args="$*"
Now sadly if I run
./myMagicShellScript arg1 "arg 2"
the single string arg 2 doesn't make it through as a single argument as I'd like.
Any thoughts as to how to escape / pass things through properly (perferably ...
I have a sentence that I want to write a shell command to grep it from a text:
The sentence is:
self.timeout=2.0
However, as this is a part of code from a file.
so it this sentence could also be
self.timeout = 2.0
or
self.timeout =2.0
or
self.timeout = 8.0
that is: there may be blanks besides "=", and the value of self.timeou...
I have a query that I need to loop.
query="select '$dbserver' as server;"
while read dbserver username password dbname type
do
mysql -h$dbserver -u$username -p$password $dbname -Be"$query" >> /home/develop/myreport.csv
done < $dblist
The following line expands correctly.
mysql -h$dbserver -u$username -p$password $dbname -Be"select '...
How can I enable logging of all the commands entered in the tcsh shell?
I've tried:
Setting the $history variable to 100.
The $savehist to 99.
Set the $histfile to $home/.history
Typing commands into the shell doesn't save the commands in the history file.
...
What's the best method to delete the first line of text from a large (10k+) group of text files.
...