General :: Feeding Input To Interactive Programs In Bash?

Aug 30, 2010

If I have an interactive program, e.g top, which, after launch, can be fed with key strokes and changes its behavior, for example, after launching top and then pressing "1", you can see the CPU utilization per core. I was wondering if there is a programmatical way to do so, so I don't have to press "1" every time. I would think it is an easy task, but so far my attempts have failed.

View 4 Replies


ADVERTISEMENT

Programming :: Bash: Feeding Input To A Script From A Text File?

Nov 17, 2010

I have a script which checks on my jobs that run on some cluster.The script, "script.sh", takes as an input the job-id for the job to be checked. Sometimes I have 100s of jobs and I want to check them all (for successful completion.) I could put these job-ids into a text file, "job-id.txt", each id in its own line.For each job-id, the script would ask me few questions (with a yes or no answers) to see if I want to do some other checks for each job-id.I want to know how may I direct my job-ids from this text file into the script one job-id at a time.

View 14 Replies View Related

Programming :: Bash: Passing Output To Another Programs Input?

Nov 12, 2009

I am not sure if that Subject really explains it, basically I have a script that executes a CLI java-applet that requires a passphrase from the user. I can easily execute this by issuing the -p argument followed by the passphrase however that shows up on possible logs or at least on the results of the ' ps ' command. If you do not supply this -p argument it provides a new line with the echo " Enter Passphrase: " and asks for input.

how can I provide a result/input for the Passphrase request and is it still possible to throw this application in the background with the ' & ' following the command? I have seen a few examples that show a /bin/expect that expects a result and sends a command however I would like to refrain from any extra dependencies. Example of Regular Execution of application:

Code:

$ /usr/local/***/**** -u USERNAME -r Default-Realm -f certificate.der
Password:

View 6 Replies View Related

General :: Interactive Bash Script To Ask For Superuser Password?

Jan 10, 2011

This is an old question asked many times, which, however, is NEVER answered directly in any manual I've checked. So...I'm writing a bash install script (instead of a rpm or .deb package) that must be run by a normal user. change to superuser (asking for password and receiving it) and the rest of the script to be executed in the superuser mode in order to install what I mean to install.I know how `sudo ...` or `su `root"..."` or `gnome-terminal -e ...` can achieve this purpose by creating certain batch files and then give them as argument to these commands. That's NOT what I'm asking, however.I want to know how I can make the script interactively switch to superuser mode and go on running the rest of the script (can be a lot of code) in that mode. I don't mind if it oens a separate terminal window to do that; just how can that be achieved?

View 8 Replies View Related

Software :: Way To Execute Bash As Interactive And Run A Command?

Jun 20, 2009

I'm trying to start bash with a command and have it interactive like this:bash -i -c "echo Welcome!"As in, execute the command and allow me to use it as an interactive shell afterwards. (I'm doing something more complicated than echoing, but this doesn't work.)I've tried this from a running gnome-terminal, from one gnome-terminal to a new one withgnome-terminal and from the Alt+F2 program launcher (with "Run in terminal" ticked).

View 6 Replies View Related

Programming :: BASH Shell Differences: Login Or Interactive

Feb 18, 2011

Intuitively I think that the Login Shell and the Interactive Shell are the same applications but have access to different environmental variables.It this true? Why is there more than one type of shell anyways? You can change users with the interactive shell, why not log on with it to?

View 10 Replies View Related

General :: [bash] Output Of One Script Is Input Of Another?

Mar 20, 2010

Now, I have one script called "defcon" defcon gets the current DEFCON level and outputs it using echo.

Code:

#!/bin/bash
DEFCON=`curl -s http://members.tripod.com/~Swat_25/defcon.html | sed -n '/^$/!{s/<[^>]*>//g;p;}' | sed '/^$/d' | grep '[12345]$'`
echo "The current DEFCON level is $DEFCON"

The second script ("tweet") updates my twitter account.

Code:

#!/bin/bash
curl -s -u USER:PASS -d status="$@" http://twitter.com/statuses/update.xml > /dev/null

What I want to do is be able to update my twitter account with the current defcon status (this is really more of a learning thing than something I actually want to be doing). The original script for tweet replaced $@ with $1, but if I use:

tweet `defcon`

it only uses the first word in the string, similarly if I used $2 or $3.So I changed it to $@. The normal function still works, but typing:

tweet `defcon`

updates twitter with nothing.

EDIT I should mention the /dev/null is there to catch the output of curl, otherwise it won't run silently. It still updates twitter normally with the send to /dev/null

View 1 Replies View Related

General :: Bash: Input Password Into A Variable?

Aug 22, 2010

I'm basically setting up two sshfs mounts and I have it set up so I run one command but type my password twice.Is there an easy to way to input a password using bash and pass that variable to another process asking for a password?

View 5 Replies View Related

General :: Bash: Auto Input Password?

Aug 28, 2010

When I use the scp command, here is a command prompt "Input password:",Now I want to use a one line command to perform the scp command.I tested the "echo "password" | scp xxx yu@10.xxx.xxx.xxx:/", but failed.

View 2 Replies View Related

Ubuntu :: Making Interactive Command Line Apps More Friendly (bash Feature)?

May 21, 2011

I'm using a java application that runs as an interactive command line (in a terminal). My problem is that it's rather unfriendly as an interaction mode as it's minimalistic: it doesn't allow going to and fro with arrows, there's no history and so on. So I have to type all commands every time and have to retype it if I missed something at the beginning of the line, or I have to copy and paste from a txt editor. The strange thing is that I have seen the same application running on a Windows box and allowing for all the sugar. So I'm not sure if it's because of the shell script I run (as opposed to the .bat) or whether it has to do with system or profile settings in my shell.

For information, the shell script starts with:
Code:
#!bin/sh
I've replaced it with:
Code:
#!bin/bash

In hope I would have something closer to my normal terminal. The app runs but it doesn't change anything to the interactive mode. I'm rather clueless regarding sh/bash and so on. I've seen the manuals but I'm not entirely at home understanding and using their options. I know that there's a .bashrc and perhaps something like a profile somewhere, but I don't really know how to do things with these without risking messing up.

View 9 Replies View Related

General :: Store User Input In A Config File GUI For A BASH Script?

Dec 4, 2010

I'm trying to create a backup script. For my second version, I want to make a GUI that will ask the user three things:

1. which folders should be excluded
2. where to store the backup
3. the user's email

I need to store this input, and later input the values into variables in my script. How do I go about doings this?

View 1 Replies View Related

General :: Find The Bash Source Files Of Programs In Mac OSX?

Jan 6, 2011

I am currently writing some convenience methods for my terminal in my bash_profile and am sure if what I am writing is "the best way". I figure a good way to verify whether what I'm doing is right or not would be to find some source code of more established programs and see how they do it.My question then is, where can I find this code on my Mac? An example is, with Macports installed, where is the source code that opens the port interactive console when I type nothing but "port" in my shell?(I added Linux in the title even though I am on a Mac because I assume the answer would be the same for both)

View 3 Replies View Related

General :: Feeding A While Loop With A Command Output?

Apr 25, 2011

I am posting this just for the sake of curiosity. I am trying to feed a while loop structure with a command output, but using the bash built-in I get the error "ambiguous redirect":

Code:
while read line
do

[code]....

View 4 Replies View Related

General :: How To Stop Form Feeding After Printing

Aug 17, 2010

I have developed an application in Qt.I want to print my text(for e.g "hello") using Qprinter and stop the printer.The text printer but i dont want form feeding after printing.

View 1 Replies View Related

General :: Conky Feeding A Line Of Crap?

Oct 10, 2010

i started messing around with conky. its really neat and i like making new configurations and what not, just for fun. the thing is, the other day i was playing around with the 'cpu' variables (cpu, cpubar, cpuguage) normally if you wanted to see the usage of say cpu0 or cpu1 you could call the variable as ${cpu cpu0} or ${cpu cpu1} respectively. well i input ${cpu5} (obviously i dont have 5 cpu's) well it still gave me output as if it was showing me the usage of that cpu. can any of you guys explain this. it also works for other parameters as well. is conky just showing me a bunch of random graphs and percentages or when i called that imaginary cpu does it default to a certain one. these are the only two answers i can come up with on my own.

View 1 Replies View Related

General :: How To Make BASH Script Yes / No User Input Query Terminate With 3 Invalid Inputs?

Mar 16, 2010

I have a BASH script which at one point asks the user a yes/no question. I want to make it so that if the user types in an invalid input 3 times consecutively then the BASH script will echo an error and terminate with exit status 1.

View 9 Replies View Related

General :: Bash Script -- Script2 Calls Script1 And Supplies Input To Script1?

Nov 2, 2010

I have an app startup script that requires user input.

# start-app.sh
Enter PIN <user manually enters PIN here>
<app startup continues>

[code]....

View 1 Replies View Related

General :: Will Not Reboot After Install (Arch) - -bash: /sbin/reboot: Input/output Error

Oct 7, 2010

I am using sda1 as /, which is a bootable drive. I do not know if my problem is that I did not create a /boot drive. After removing the iso dvd, I tried to reboot and I get this back: -bash: /sbin/reboot: input/output error Then it returns me to the terminal prompt.

View 6 Replies View Related

Fedora :: Fortran Programs And Long Path Names Input's

Apr 30, 2010

I have a fortran program example call like this:

This call cant run my fortran program because they output to the screen that the file ' ' (empty) cant be loaded!

So the problem is that my program cant see the file in the long path name above ( the real name is a bit more longer). I try with shorts path names , and the program can run, reading the input file.

I googleit for this type of error and only found that bash have limits on the filenames and inputs, so i change them (/usr/local/linux/limits.h or some like) to a very high value (999) ,but no success.

View 3 Replies View Related

Fedora :: Can't Input Chinese In Bash And Sh,--(fc13)

Dec 29, 2010

i can input chinese in vim ,gvim,gedit ,and also zsh...., but i can't input chinese in bash and sh , i use ibus.

If i login with another account , i can input chinese in bash and sh !

i also diff the locale and env between the two account ,they are nearly the same;

example: when i input chinese ""i type "wq" and space,then bash print :

Display all 4063 possibilities? (y or n)

View 1 Replies View Related

Ubuntu :: Bash Script For Each Line Of Input?

Jul 21, 2011

I've written my script so that it reads in the variables $1 $2 $3 $3....$12I have an input file as follows

word1 1 1 2 3 4 5
word2 1 1 2 3 4 5 6
word3 1 1 2 3 4

[code]...

View 9 Replies View Related

Programming :: User Input Bash Script

Apr 28, 2010

I've written a bash script that allows a user to input a directory location to find out the size of the directory. However, if the user inputs a directory and finds its size then inputs another directory then wants to quit, the script asks the user numerous times if he wants to quit!! The script won't exit until the number of times the user looks at a directory is reached! What gives?

Here's the script:

Code:

View 4 Replies View Related

Software :: Bash Input Control - Different Numbers ?

Mar 18, 2011

I'm making an bash script.

As input you can input different numbers from 1 to 3.

Depending from the input a text shows up.

View 2 Replies View Related

Programming :: Read Multiple Input With Bash?

May 7, 2010

As I'm starting to learn bash scripting I'm trying to automatize some tasks I usually perform. I have a notification mail I need to send several times a day. It has this structure:

Quote:

Dear user,
blah blah blah blah

You need to contact the following people:

[code]...

To replace "user", I found this:

Code:

read -p "Please enter username: " username
echo "Dear $username,"

Which probe to be very useful with other simple notifications like this. But I don't know how to manage the email addresses as they are usually more than one and could vary from 1 to 10. They should appear one above the other. I found this: "Here is a little work around. The only thing the user needs to do is hit enter without anything else on a line and it will close out"

Code:

#!/usr/bin/ksh
word=a
until [[ $word = "" ]];do

[code]....

I tried to use it and modify for my needs but I failed, I don't realize yet how can I use it. If possible, I would like to use the until loop like the above example just for learning purposes but any other form will be accepted as well.

View 10 Replies View Related

Programming :: Working With User Input In Bash

Jun 2, 2009

I've been using python/bash to help myself automate things for a long time, however I am curious. One reason I use python more is because I don't quite know how to work with user input in Bash, such as getting it to ask for input and wait, and then placing that user input into a command.

Here's an example of a script I use from time to time for converting OGG video files into AVI.

How could I write this same script in Bash? Keep in mind I am mostly self taught, so I am by no means an expert programmer.

Code:

View 3 Replies View Related

Ubuntu :: Bash Script, Take User Input Then Use It As A Path?

Jan 29, 2011

I'm trying to make a script to make it quicker to encode videos.

Code:
#!/bin/bash
echo "Type the path of the video file"

[code]....

View 9 Replies View Related

Red Hat / Fedora :: Change Input/Output Color In Bash?

Jun 5, 2009

When in the interactive envirment, my Input and Output are all mess-up. So i want to color the Input and Output with two different colors.. so i can figure them out..

View 1 Replies View Related

Software :: Bash : Input A Mp3 And Output The Lyrics As Text?

Dec 18, 2010

I am looking for a prgramme that output the lyrics when I give it an mp3...

Code:

fetchlyrics mymp3.mp3

based on its data inside of mp3

View 7 Replies View Related

Software :: Bash Script: Wait For Input From Kdialog Before Doing Sth?

May 27, 2011

The goal of the script is the following:Whenever I leave my house, my wife comes to my computer to check her mails (She has two computers of her own but they have a dangerous operating system, so they have been banned from the internet).She shuts down qbittorrent so as to download all her mails, and she forgets to execute it again on 98% of the times. End result: my computer is sometimes turned on for 10 hours doing absolutely nothing.I had therefore two choices: a) get on my wife's nerves until she gets the problem or b) write a bash script.If you are married, you will understand that bash scripts are easier to deal with than spouses.Ergo, I wrote the following script:

Code:
#!/bin/bash -x
while true ; do

[code]...

View 3 Replies View Related

Programming :: Bash: Handling Input From File And Keyboard?

Jan 20, 2009

I have this little shell script which copies file names taken from inputfile:

Code:
while read line; do
cp -i $line something

[code]...

View 4 Replies View Related







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