Programming :: Bash Checking For File Write Completion Before Acting?

Jan 20, 2011

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].....

View 10 Replies


ADVERTISEMENT

General :: Make Zsh Completion Behave Like Bash Completion?

Jun 2, 2010

I switched to zsh, but I dislike the completion. If I have 20 files, each with a shared prefix, on pressing tab, zsh will fully complete the first file, then continue going through the list with each press of tab. If I want one near the end, I would have to press tab many times.

In bash, this was simple - press tab and I would get the prefix. If I continued typing (and pressing tab), bash would complete as far as it could be certain of. I find this behavior to be much more intuitive but prefer the other features of zsh to bash.

Is there a way to get this style of completion? Google suggested setopt bash_autolist, but this had no effect for me (and no error message was printed upon starting my shell).

View 1 Replies View Related

Programming :: Write An If Statement For The First Line Of A Text File Bash?

Feb 15, 2011

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]....

View 2 Replies View Related

Programming :: Simple Bash To Write Files By Year To A Log File

Jan 31, 2011

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?

View 2 Replies View Related

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

Nov 29, 2010

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 View Related

Programming :: Bash Write To End Of Each Line?

Nov 29, 2010

i have a text file like

abc abc abc abc
abc abc abc abc
--- --- --- ---

i want to add a string xyz to end of each line..

abc abc abc abc xyz
abc abc abc abc xyz
abc abc abc abc xyz
--- --- --- --- xyz
--- --- --- --- xyz

how do i do this in bash?

View 13 Replies View Related

Programming :: Bash To Read Write Registers?

Jun 3, 2010

I have been looking for a script example of reading and writing to the parallel port's data, status, and control registers using bash. I see it done in pascal, tcl, etc. but nothing in bash.

View 5 Replies View Related

Programming :: Write A Bash Script To Call From A Terminal?

May 24, 2010

I am trying to write a bash script to call from a terminal that will change the terminal title. I am using ubuntu 10.04. The script is meant to be used in the gnome-terminal.

Here is what I have:

Code: #! bin/bash
echo "New title: c"
read title
echo "33]0;$titl07c" -e

[Code]....

it doesn't work

I think the problem has to do with modifying PS1 inside the bash so i tried this:

Code: echo `export PS1="[e]1;u@h:wa]${debian_chroot:+($debian_chroot)}u@h:w$ "` and it still didn't work.

View 1 Replies View Related

Programming :: Write A Bash Script That Will Launch A Command?

May 15, 2011

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.

View 2 Replies View Related

Fedora :: SSH Knowhost Bash Completion In F12?

Dec 10, 2009

New Fedora 12 install - I installed the bash_completion package, but it's not filling in knowhosts for ssh. It worked fine in Fedora 11. Is there something I've done wrong, or is this missing in F12?

View 6 Replies View Related

General :: Making Bash TAB Completion More Like Cmd.exe?

Dec 15, 2010

I wondered if theres a way to do rotational style completion in bash similar to the behavoir on cmd.exe, I've found it speeds me up in regard to entering commands

View 2 Replies View Related

Ubuntu :: No Bash Completion With Sudo?

Apr 29, 2010

Just installed 10.04 64bit and in gnome-terminal i have no bash completion when sudo is used.For example:apt- gives apt-getbut sudo apt- does nothing, i get no suggestions from the terminal.

View 6 Replies View Related

Software :: No Bash Completion With Apt In Su Session?

Mar 28, 2011

I have disabled root ssh logins for security. When I am logged in as a normal user over SSH and do a su into root the tab-completion stops working with apt. It still works when doing normal file-browsing, on the original user1, and it has worked previously when logged directly into root. How do I make it autocomplete again? I am using Debian Stable on a headless homeserver.

View 3 Replies View Related

Programming :: Write A Bash Script That Continue Monitor The Tmp Directory?

Dec 25, 2010

In my tmp directory some logs are creating continue (with name logs.txt1, logs.txt2 up to 245). Some times these logs are creating continue within 1 or 3 second gap, now I want to write a bash script that continue monitor the tmp directory and if any time logs create simultaneously within 1 or 3 section gap it will alert me..( generally logs are create with the gap of 5 or 10 minutes duration or some time after one hours )

View 1 Replies View Related

Programming :: Write A Bash Script That Will Make Some Web Stats Reports

Jun 23, 2010

I'm planing to write a bash script that will make some web stats reports and I'm stuck on beginning because I don't know how can I read a directory content, put everything in a variable, compare the variable value with current date and go further.More specific ...

I have /var/apache/log/. Here I have access logs on date ( like access.log.24.06.2010.gz and so on ).

How can I do to automatically zgrep (in a bash script) last day .gz ??

View 3 Replies View Related

Programming :: Write A Bash Script That Recognizes When The Mouse Moves?

Oct 6, 2010

I try to write a bash script that recognizes when the mouse moves.

like a screensaver.

But I want that while a browser window is opened and I move the mouse that a new webpage loads.

I can open opera with a console command but how can i recognize that the mouse moved?

View 1 Replies View Related

Programming :: Write A Bash Script That Sources Another Bash Script?

Jan 29, 2011

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]...

View 5 Replies View Related

Fedora :: Do Bash Completion Of Package Names In Yum?

Jul 12, 2011

Can fedora do bash completion of package names in yum?

View 4 Replies View Related

Ubuntu :: Bash Completion With Leading Wildcard?

Jul 17, 2010

Out of the box, Bash in 10.04 is configured such that it won't expand/complete parameters when there's a single match for a parameter with a leading wildcard. For example, if I have the following files in a directory:

Code:

ABC.bin
DEF.bin
GHI.bin

...and I type cp *E*, I expect to be able to press TAB and have Bash expand *E* to DEF.bin, since that's the only file in the directory with a capital E in its name.

(Note: if I actually submit the command with the wildcards in place, the correct file will be used then, but I don't get to see it beforehand.) I imagine there's something in /etc/bash_completion that's preventing this from working properly. Does anyone know what it is?

View 1 Replies View Related

Ubuntu :: Turn On Bash Smart Completion?

Aug 26, 2010

[URL]

Code:
#if [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
#fi

What versions of Ubuntu have this commented out? Every version I have used always has this uncommented.

View 1 Replies View Related

General :: Handling Wordbreaks In Bash Completion?

Feb 16, 2010

I am writing completion function for one PHP framework called symfony. It has command line interface with syntax:

Code:

symfony [options] [namespace:]action

I want to make action be autocompletable. The function is simplest so far:

Code:

function _symfony_commands()
{
[ -r "cache/completion/.sf" ] && cat cache/completion/.sf
}

[code]....

But, if there is : symbol which separate namespace from action problems coming:

symfony doct[TAB]
will be completed to
symfony doctrine:

But nothing happens if you want complete after : symbol. I've found out that for readline there is three words because it splits line with $COMP_WORDBREAKS

Code:

$ echo $COMP_WORDBREAKS
"'><=;|&(:

I played with $COMP_WORDS array and tried every thought I had to make it work, but failed.
What I should do to escape colon and make readline consider it as one word? Or there is way perhaps to workaround it?

View 2 Replies View Related

Software :: Bash Hostname Completion Not Working?

Nov 25, 2009

According to the Bash man pages, Quote: HOSTFILE Contains the name of a file in the same format as /etc/hosts that should be read when the shell needs to complete a hostname. The list of possible hostname completions may be changed while the shell is running; the next time hostname completion is attempted after the value is changed, bash adds the contents of the new file to the existing list. If HOSTFILE is set, but has no value, bash attempts to read /etc/hosts to obtain the list of possible hostname completions. When HOSTFILE is unset, the hostname list is cleared.

Here's the line in my .bashrc where HOSTFILE is set:

Code:

export HOSTFILE="~/.hosts"

I opened a new bash session, created ~/.hosts, filled it with the names of servers that I wanted to expand using tab completion. then typed

Code:

ssh p<tab><tab>

expecting to get a lists of all of the hosts in ~/.hosts starting with 'p'. Bash simply beeped at me twice.

I tried

Code:

$ shopt hostcomplete
hostcomplete on

Code:

ssh bchittenden@p<tab><tab>

same results.

[code].....

View 2 Replies View Related

Software :: How To Write Bash Script To Locate File

Aug 5, 2011

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

View 8 Replies View Related

Programming :: Write A Bash Script To Time Some Downloads From A Server Using Ftp Connection?

Jun 8, 2010

I write a bash script to time some downloads from a server using ftp connection. ( something like: "time ftp 'options' ) I need to count the time for a list of files in a loop and output the result in a file.

View 1 Replies View Related

Programming :: Write A Bash Script Program In System Command Terminal?

Mar 22, 2010

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"

View 5 Replies View Related

General :: Bash - Get Colored Output When Using Tab Completion In A Terminal?

Feb 27, 2011

Is there a way to get colored output when using tab completion in a terminal? My colors are fine everywhere else so I know that I've enabled a color terminal successfully. Using bash in Ubuntu (10.10).

View 1 Replies View Related

General :: Tab-Completion In Bash Indexing System Folders?

Nov 15, 2010

tab-completion indexes system folders (like /usr/bin, /usr/local/bin)! so say i'm in a folder that has two files, 'text' and 'myprog', i type in an 'm' then tab, and i get hundreds of results including 'mysql', 'mysqlconfig', and others as im sure you can imagine. is there a way to set it to default or something else that will only make it index the current folder?

i tried changing my PATH variable so i could execute programs in the current directory without './' - what i added to PATH was ':.' at the end (apparently this is not the way to do it... :S). i tried resetting PATH various times ('unset PATH', 'PATH=$whatever...') but this has not fixed the problem. using 'unset PATH', of course, removes everything from PATH, which meant that functions (like 'ls') in /usr/bin and /usr/local/bin can't be found. obviously i want those to be found, but i would rather not tab through them!

View 2 Replies View Related

Slackware :: Bash-completion-1.3-noarch-1 Causes Xorg Failure?

Feb 16, 2011

/etc/bash_completion.d/slapt has a syntax error that causes x to fail to load. I had to move the file to be able to run x. Here is the offending file:

[URL]

View 12 Replies View Related

Fedora :: Write A Bash Script That Will Create A New Text File?

Oct 22, 2009

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.

View 4 Replies View Related

General :: Write A Bash Script To Parse A Text File?

Apr 27, 2011

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 =

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved