Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Linux


Advertisements:










General :: Write A Literal Bash Command In A Bash File?


I create a bash script that writes another bash file. But in the generated bash file I want to write a bash command in the file and not executing it.Here's my bash file:

Code:
#!/bin/bash
cat > ~/generateGridmix2data.sh << END

[code]...


View 6 Replies (Posted: 11-29-2010, 06:41 AM)

Sponsored Links:

Related Forum Messages For Linux category:
General :: Write A Bash Script To Parse A Text File?
I want to write a bash script to parse a text file with the following lines and set variables for each line so that I can use them in the rest of the script.

Timestamp=123456789
Company=ABC Company
Server=Server
Recipient=Joe Smith
Email=joe@abc.com

simplest way to read each line one at a time for everything before the =, set that to a variable name with the value equal to everything after the =

Posted: 04-27-2011, 11:46 PM

View 14 Replies!   View Related
General :: Write A Bash Script That Will Read The Word From The Text File?
I have a text file that contains a single word and I want to write a bash script that will read the word from the text file... The following is my incorrect attempt, as it assigns the name of the textfile to the variable as opposed to the word stored within the textfile:(assume I have a text file value.txt that has its contents a single word, say wordone)

Code:
#!/bin/sh
for f in value.txt
do
echo $f
done

so the output of the above script is value.txt, however I want it to be wordone.to summarise: how do I assign the value of the word contained within a textfile to a variable?

Posted: 06-10-2011, 06:38 PM

View 1 Replies!   View Related
Software :: Bash Command History Log / How To Write It Continuous?
I've been looking for how to set this up in bash with no luck so far. I can change what file the history log is written to, and how much history is saved. But it only writes the saved part when bash exits. Instead, I'd like to have bash write that file continuously as each command is entered (and maybe also do an fsync(2) to flush it to disk). That way I can see the command I crashed the box with Anyone know the magical incantation for that?

But there appears to be nothing that I can find there, in the man page, or other searches, that suggest it even can do continuous.

Posted: 04-14-2011, 11:40 AM

View 12 Replies!   View Related
Programming :: Write A Bash Script That Will Launch A Command?
I want to write a bash script that will launch a command when ever I plug my phone in. how would I monitor the port in a script.

Posted: 05-15-2011

View 2 Replies!   View Related
General :: Pass A File That Changes Name To Another Command In Bash?
I frequently use wget to download tarballs and zip files from the web, then either untar then or gunzip them. I do:

Is there a way for me to automatically pass the zip file to tar or unzip WHILE wget-ting?

In pseudocode: wget google.com/somfile.zip && unzip

Posted: Jun 9 at 14:32

View 3 Replies!   View Related
General :: Run Command Through Ssh But Also Run A If Check In Bash To See Ifa File Exist?
So I want to run command through ssh but also run a if check in bash to see ifa file exist. I know that to run ssh commands you do ssh user@server YOURCOMMANDbut if i need to run an if statements, how would this work??

Posted: 08-01-2011, 02:11 PM

View 4 Replies!   View Related
Programming :: Write A Bash Script Program In System Command Terminal?
I'm trying to write a bash script program in the Linux command terminal that will write to a fellow user and then continue reading down the program. this is what i have (kind of explains the idea too):

#!/bin/sh

clear
echo "this is before the write command"
write jcummins
this message should go to jerry
echo "the message didn't send and this string will not appear"
echo "it appears it has stopped at the write command"

Posted: 03-22-2010, 08:51 PM

View 5 Replies!   View Related
General :: Cd Command Not Working In .cshrc File (bash Shell SUSE)?
Just trying to execute cd command in a .cshrc file (bash shell in SUSE Linux) it says."No such file or directory".Do you see any reasons for this

Posted: 05-29-2011, 11:46 PM

View 3 Replies!   View Related
Software :: How To Write Bash Script To Locate File
I mean codes on how to write a bash script for locate file. E.g: This utility shows you all files and directories that have a specific substring in the name. Press '?' for help, 'q' for quit or enter your search terms:

Kuala bin
I have searched for two terms for you,
Kuala, which has three hits:
/usr/share/zoneinfo/Asia/Kuala_Lumpur
/usr/share/zoneinfo/posix/Asia/Kuala_Lumpur
/usr/share/zoneinfo/right/Asia/Kuala_Lumpur bin, which has 2312 hits.
Are you sure you want to see all of those? [Y/n] n
Press '?' for help, 'q' for quit or enter your search terms:
Sorry, you didn't enter any search term.
Press '?' for help, 'q' for quit or enter your search terms: q

Posted: 08-05-2011, 03:30 AM

View 8 Replies!   View Related
Ubuntu :: Terminal Bash / -bash: Ls: Command Not Found
I got a problem with terminal, since i'm really a noob with terminal i don't know how to fix it.Everytime i type in a command it shows for example:

-bash: ls: command not found

Even the basic commands don't work... just cd <directory> and those things works

Posted: June 5th, 2011

View 9 Replies!   View Related
Programming :: Bash Checking For File Write Completion Before Acting?
I have a bash script that checks for contents in a folder every 15 seconds and then acts on it's contents. This works great for the average size file however on very large files it starts acting on the file before it's completely written. Is there a facility in bash shell to get a file complete signal or such? here is trigger to launch a larger script.

Code:

#!/bin/sh
while true
do
$HOME/bin/hpgl.sh >/dev/null 2>&1 &

[code].....

Posted: 01-20-2011, 05:03 AM

View 10 Replies!   View Related
Programming :: Simple Bash To Write Files By Year To A Log File
I have a folder of 2 many files that the old ls just hangs.

I am trying to write some log files such as;

I don't mind doing one at a time, but I am just playing and even getting the listing I am not getting the date stamp, I have the following;

That does create the file, but all the files look like this;

So basically it's just sticking that ls inside the log file and not actually running the ls, so how can I use the above type to get files just created per year?

Posted: 01-31-2011, 08:36 AM

View 2 Replies!   View Related
Programming :: Write An If Statement For The First Line Of A Text File Bash?
At the moment I got my md5sum checking working which I write to a text file and see below.

If the md5sum works it will write the output to check2.md5 test.txt: OK

If the md5sum fails it will write test.txt: FAILED

How do I write if statement to check the output whether or not the md5sum failed or not ?

check1="/home/ops/Desktop/test1/check1.md5"
check2="/home/ops/Desktop/test1/check2.md5"
cd /home/ops/Desktop/test1
md5sum test.txt > $check1

[Code]....

Posted: 02-15-2011

View 2 Replies!   View Related
Fedora :: Write A Bash Script That Will Create A New Text File?
trying to learn how to write a bash script that will create a new text file named jimbola in my home directory. The file will need to be able to have the first and last name of Jim Bola included in it.

Posted: 22nd October 2009, 10:25 PM

View 4 Replies!   View Related
Programming :: Write A Bash Script That Sources Another Bash Script?
I am trying to write a bash script that sources another bash script. Essentially, I need a few lines to check to see if a certain variable is set. If not, I set it manually, and then source a scripts with that variable in the path. I wrote a test script to try it, but for some reason the last line does not work. Here is what I wrote:

#!/bin/sh
source ~setupdir/setup.shrc #just a test, this line works
echo ${#SETUP} # prints 0 if setup is not set, which it isn't
if [ ${#SETUP} -eq 0 ]
then
SETUP="~setupdir"
fi
echo $SETUP # prints ~setupdir

[Code]...

Posted: 01-29-2011

View 5 Replies!   View Related
General :: Write A Bash Script Using An If...Then...Else Statement?
I need to to write a bash script using an If...Then...Else statement that will accept a day of the week from the command line what do I do or where do I go.

Posted: 05-14-2010, 07:09 PM

View 2 Replies!   View Related
General :: Write Either PYTHON Or Bash Shell Scripting?
I do not know how to write either PYTHON or Bash Shell Scripting. I am to learn one for Linux Administration purpose. Which one will you recommend for a Linux Admin/Eng environment?

Posted: 06-04-2010, 10:03 AM

View 4 Replies!   View Related
Security :: Write Secure Code For Bash Scripts In General?
how to write secure code for bash scripts in general? Strangely I didn't found anything in google and in the forum so far. If someone here is willing to review a bash script for me (about 600 lines).

Posted: 02-09-2010, 01:45 AM

View 6 Replies!   View Related
General :: Write Bash Script To Mimic Right Button Click?
how do i write a bash script to mimic my right button click any ideas or command names to steer in the right direction would be great.

Posted: 07-09-2010, 08:53 AM

View 3 Replies!   View Related
General :: Write A Bash Script That Gets The List Of Files In A Directory?
I'm trying to write a bash script that gets the list of files in a directory and puts them into a variable, then checks each entry and outputs them as follows:

item1 is a FILE
item2 is a DIR
item3 is a DIR
etc etc.

I am able to get the list of files into a variable, but unsure how to get the output I want.

Posted: 04-05-2010, 07:23 AM

View 3 Replies!   View Related
Programming :: Bash Command Redirecting Output To File?
I am trying to do something 'simple'I have a bash program that gives output in the commad prompt eg.Code:00 12 03 C2 EE ...I want to grep a line containing value 'C2' and put the line into a file.I tried:Code:$./serial 1 | grep C2 > databut it doesn't work. I don't get any errors but there is no data in the file. BTW, serial is the program that monitors serial port 1 and spits it out on the command.

Posted: 11-07-2007, 02:16 PM

View 10 Replies!   View Related
Ubuntu :: Chroot - Cannot Run Command '/bin/bash' - No Such File Or Directory
I have booted up into Ubuntu 10.04 LTS disc live.

When I type 'chroot /media/(UUID)', I get:

chroot: cannot run command '/bin/bash': no such file or directory.

'/bin/bash' does exist.

Why is this error occurring?

Posted: 07-01-2011

View 3 Replies!   View Related
Ubuntu :: Bash Command To Find And Replace Text In File
I'm having problems with Tomboy. I have a few hundred note files and I need to go through all of them and replace all instances of "<link:broken>a</link:broken>" with "a". Is there a bash command I can use to do this?

Posted: April 3rd, 2010

View 2 Replies!   View Related
Ubuntu :: Chroot Not Working: Cannot Run Command `/bin/bash': No Such File Or Directory
I'm trying to change the root directory to /tmp/somedir using chroot, but even using sudo or su-ing to root I get the message:

Code:

cannot run command `/bin/bash': No such file or directory

I tried copying /bin/bash to /tmp/somedir/, but the same error occurs. What's wrong with my chroot?

Posted: March 20th, 2010

View 7 Replies!   View Related
Copyright 2005-08 www.BigResource.com, All rights reserved