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
ADVERTISEMENT
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
Nov 1, 2010
I have a write call to a ttyACM serial device that blocks after several hundreds bytes are written.I'm writing in ~25 byte chunks, so I have 5-8 successful writes, then the next write blocks forever.I can bypass the blocked call using select, but I can never call write again without closing and re-opening the port.
The serial port is opened correctly because I can read from it just fine. Write permissions are correct, and it's opened RW.The code is likely correct because I tested the same code using the same device on a pure RS-232 serial port, and it worked fine - no block. Is there anything to know about the linux ACM module?It's my understanding that write calls basically shouldn't block.They're supposed to return -1 if there's an error.
View 1 Replies
View Related
Oct 31, 2010
i am using front end as java and back end RHEL5.i am trying to calling a bash script with java. but i am facing problem.i am using following java coding to use call the bash script
import java.util.*;
import java.io.*;
public class b
[code]....
View 4 Replies
View Related
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
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
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
Mar 8, 2011
how i can use the cal command so it displays the current month and the next month, i know you can use cal -3 9 2007 to show the previous current and next but i just want to display the current and next.
View 9 Replies
View Related
Mar 23, 2010
I am writing a code in bash script, in my ubuntu command terminal. The program should send the message, "Hello John!!" 5 times to john's terminal (assuming he is logged on to the server). But I keep getting this error: Syntax error: end of file unexpected (expecting "done").
#!/usr/bin/sh
clear
x=1 # this sets up the flag so we can have it send a limited amount
while [ $x -le 5 ]
do
write jdouglas << EFO
>Hello John!!
>EFO
x=$(( $x + 1 ))
done
View 1 Replies
View Related
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
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
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
View Related
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
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
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
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
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
Apr 8, 2010
I want to write a bash script which can open a new gnome-terminal window.
In that gnome-terminal window, it should goto a specific directory and edit a file using Vi Editor.
How is it possible to do that?
View 7 Replies
View Related
Apr 6, 2011
I'm trying to do something here:: I'm writing a bash script, I want to [open a new terminal and run a bash command in it] inside the script. I tried to use this, but apparently I get syntax errors.
Quote:
#! /bin/bash
echo "echo Something" > ~/Second.sh
chmod +x ~/Second.sh
xterm -e sh -c ./Second.sh
View 14 Replies
View Related
Dec 22, 2010
I've got some bash scripts that I'm testing which operate on different screen sessions under different usernames. In order to check the status of them, however, I have to attach the screen sessions to my current terminal.
I run into problems, though; I only allow SSH to my machine from one username; the others shouldn't need SSH access. So, I log in as one user, and su into whichever user I need. Without performing a chmod o+rw on the terminal before I su into a different user, screen complains that it can't reattach to my terminal, because the user trying to make it attach doesn't have the permissions to do so.
Seeing as I forget to do this a lot, I wanted to make a script that I'd run on log-in to do this for me. Unfortunately, I don't know if there's a bash variable that refers to the current terminal - I can't always guarantee that I'll be logging in to /dev/pts/0, especially if my internet connection gets cut and I leave a hanging terminal...
Is there a variable for that or a way to refer to it in a script? If not, how do I work around that?
View 4 Replies
View Related
Feb 16, 2011
I am running a Java application on the command line bash terminal under Mint Debian. I have JDK1.6.0_22 installed 64-bit, and the OS is 64-bit too. I have a few JAR files in the directory and a few native LWJGL libraries. When I run the application using the command line, all works fine.
Lets assume my directory where the files are is called /home/riz/MyGame. I change to that directory and this is the command I use code...
View 3 Replies
View Related
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
Sep 21, 2010
First, i have no experience with javascript. I came across an interesting site and I'm curious if I could make a private webpage to call some shell commands or just open a terminal.Yes, i know this could potentially be malicious and possibly illegal. Again it's for my own private usage.
View 1 Replies
View Related
Sep 29, 2010
I want my bash script to run scripts located on a different folder. If it is also located on the same folder with my script, it will go like this:
on my $HOME folder: (this_script.sh, backup.sh, restore.sh, purge.sh)
#!/bin/bash
./backup.sh
./restore.sh
./purge.sh
But what if, on my $HOME folder: (this_script.sh)
$HOME/scripts folder: ( backup.sh,restore.sh, purge.sh )
Below doesn't work...
#!/bin/bash
./$HOME/scripts/backup.sh
View 5 Replies
View Related
May 2, 2011
I'm trying to remember how to use the output of a nested Bash builtin call. So `which prog` gives me the path to the program, i'm interested in. Then I would like to get the directory path leading to that program and plug it into 'cd', so i end up in the directory containing the program.
View 5 Replies
View Related
Feb 18, 2011
I'm working on Linux OS (Suse/redhat) and trying to format a linux partition from a c program. Is there a way to do this without using : 'system ("mkfs.ext4 /dev/sdxy")'
View 4 Replies
View Related
Jun 30, 2011
Me and my friends have a website about games and stuff. The web hotel we use clears the app-pool when it has been inactive for 15 minutes. We don't have that many users yet so this is a problem because it takes ages to load if it has been inactive. I came up with the brilliant idea of calling the website with a script from my private server at home every 5 minutes or so. That way it would never go down.
I used some lines from another of my scripts:
wget -q -O - http://homepage.se/ > /path/to/a/file.txt
cat /dev/null > /path/to/a/file.txt
and put it in crontab.
The script runs and all and I think it's better now but we can't know for sure if it is the scripts doing. Sometimes it's just as slow as ever and I start to think the script doesn't do anything. I've tried adding more wget-lines to fetch some different pages from the site and now running it every 3rd minute. No difference. Does anyone know another way to call a website in a way that would solve my problems? Am I using the wrong options with wget maybe? I've tried lynx (and piping to file) but it didn't work.
View 7 Replies
View Related
Nov 22, 2010
I need to call a .sh script without directly opening the terminal. Is possible to do so writing and compiling a script (e.g. Java or Python) so when I double click it, it opens a terminal window and runs the .sh automatically?
View 4 Replies
View Related
Jan 13, 2010
how to call or resume a paused process in to another terminal.
View 1 Replies
View Related
Feb 29, 2016
I mainly use debian jessie , recently i have installed daragora as my second os to get a feel of gnu/linux . the problem is that dragora uses bash , and it's commands are different from debian jessie terminal is there a way that i can use the same commands here in dragora?
View 4 Replies
View Related