General :: Bourne Shell Input From File Using - Then Return Control To User?

May 5, 2011

I have a program that I run from the terminal that requires manual input (it's matlab in mex debugging mode, matlab -Dgdb, which starts the GNU C debugger with its own custom settings).

Every time I run this program I always type in the same few commands in the program's interactive shell before I actually start working (for example: run -nojvm; stop at mexFunction; continue). I want to avoid typing these commands and I thought I could do this with shell scripting, saving the commands in the mycommands file, then running: myprogram < mycommands

The problem is that this runs all the commands and then exits the program. I want it to run the commands and return control to me so I can run my commands. Is there a way to tell the shell to use a file or a string as the input to a program then immediately return control to the user without the exiting the program?

View 3 Replies


ADVERTISEMENT

Software :: Using An Shell Script - How To Change A Value In A File According To The User Input

Sep 28, 2009

I have a file called a.sql which I need to execute in a database and the script I am calling in a shell script .Before executing the script I have to change a value in the script according to the user input.How can I do this .

Eg...
A.sql file contains an sql query like this:

And My shll script is like this:

When executed the script it asks for enter salary and if the user has input 5000 then the Enter_salary value in a.sql must be replaced by 5000.

View 6 Replies View Related

General :: Getting The Bourne Again Shell?

Jun 30, 2011

I just upgraded my OS and find that I have a generic type terminal.How would I go about getting the Bourne again shell?

View 14 Replies View Related

General :: Alternative To $0 In Bourne Shell?

Aug 25, 2010

I am looking for an alternative to using $0 in bourne shell. I am in the process of migrating all my production shell scripts to a new tool that will automate execution and release of "jobs" in my production system. And this tool does not like the usage of $0. Which means echo $0 or "basename $0" returns null.

View 2 Replies View Related

Programming :: Can Expect Return Control Of A Spawned Process To A Shell Script

Nov 19, 2009

Is it possible to have an Expect script spawn an SSH session, log in, then go into interactive mode and give control of the SSH session to a Bash script? Here's a simplified example of the script so far:

Code:
#!/bin/bash
expect -c "

[code]....

View 4 Replies View Related

General :: User Defined Input In Shell Script

Dec 2, 2010

I want ssh a remote server through shell script with predefines username and passwd. i dont know how to use expect command to do that.

View 4 Replies View Related

General :: Write A Shell Script Which Will Read The Directory Path As Input From User?

Nov 28, 2010

I am new to writing shell scripts. So, please bare with me. I am currently trying to write a shell script which will read the directory path as input from user and will traverse the Dir tree to find all available audio and video files. I have tried to write as much as I could but I don't know where I am making mistake as I get some files to be audio file which are actully tar balls. On the second note there are some files which video but script shows them to be audio. And, some video files are completely skipped. I am giving the shell script below so that you can see. I am using two external files as source which I am attaching.

Code:

#!/bin/bash
#Let's load the extensions that we want to search for
vdExt=$(cat vdExtList)
adExt=$(cat adExtList)

[code]....

View 5 Replies View Related

Ubuntu Servers :: SSH In Bourne Shell Script?

Oct 6, 2010

I have a question about using bourne for a shell script. I have a script that at the moment performs a logical dump of my database, backups up the physical files of the database, and backs up everything within /var/www

I want to be able to copy the files over ssh to a remote server. However, the only way I am able to find examples of doing this is when you exchange keys and do not need to provide a password. How can you write a script that requires a password, not key exchange? I was told I specifically have to do it this way.

View 3 Replies View Related

Software :: Install Bourne Shell On Ubuntu?

May 30, 2011

So, is there anyway to install Bourne shell in ubuntu? How can we bring Bourne shell to ubuntu?which Linux distro uses Bourne shell.? Is there anyway to use it via VirtualBox?

View 2 Replies View Related

Programming :: Take A Single Line Of Input From User In Shell Script?

Mar 10, 2011

How do i take a single line of input from the user in a shell script?

View 3 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 :: How To Look At History File In Unix Shell For User?

May 28, 2010

How to Look at history file in unix shell for a user, find 5 most often used commands.

View 5 Replies View Related

General :: Unix - Making Shell Prompt Show Last Return Value

May 30, 2011

I'm currently on a Linux machine and the shell prompt is showing me the last return value and number of executed commands (picture included, with these numbers shown in purple).

My own computer doesn't have this, how can I configure it? I'm using Xubunto, if more details are needed let me know -- I'm not much of a Linux user (I don't know what's relevant here).

View 3 Replies View Related

Programming :: Shell Programming - Delete User Input

Jan 21, 2011

I recently started shell programming and my task now is to do a menu display.Currently i am stuck whereby user will input both title and author and it will delete it.

Do i have to use sed command?

View 4 Replies View Related

Programming :: C - User To Input The Name Of A File As An Argument

Aug 5, 2010

Write a program that requires the user to input the name of a file as an argument. If the user fails to include one argument it should make use of a thread that handles a signal. The signal handler should tells the user Incorrect number of arguments and then calls the terminate signal on the process.

If the numbers of arguments are correct then the program should allocate memory space to the file (5MB) and create a child process that requests the user for a character that it should send to the parent. The child should keep request for data until the user keys in the character O. During each request it should pause for 10 seconds, send the character to the parent and then requesting again for another character.

The parent should get the character from the child. Do not make the parent wait for the child to finish requesting for data. Make use of pipes to facilitate communication between the parent and the child. A second child should be created to read and display data from the file. Make use of any appropriate Inter Process Communication technique to ensure that the second child and the parent do not access the file simultaneously (Mutual exclusion).

View 5 Replies View Related

General :: $HOME/.bashrc Disabled When User Shell Is 'rbash' (restricted Shell)?

Jun 15, 2011

MACHINE: HP Proliant DL260G5OS: SLES 11 SP1kernel: Linux xserver 2.6.32.12-0.7-default #1 SMP 2010-05-20 11:14:20 +0200 x86_64 x86_64 x86_64 GNU/LinuxIt is used as remote xserver in a LAN.I have configured /usr/lib/restricted/bin/.rbashrc with some environment variables but when the users logon in the system finally is executed $HOME/.bashrc and some environment vars are overwritten.

View 2 Replies View Related

General :: Grep: Return An User Message When No Hits?

Jun 13, 2011

I have ASCII files to parse that 48 hours old or more ; I can identify them like so

Code:
find . -name "FILE*TXT" -mtime +1 -exec ls -ltas '{}' ';'

Some files have a list of hardware errors (we test electronic components), some have none. If the file name has no errors, I still want to display a message like so

Code:
grep ^err R*VER && echo "No error"
FILEA.TXT:err->USB3910err
FILED.TXT:err No Error

This grep statement works but it seemingly overrides the find() statement above if I run both at the same time... How can I combine the two statements to create a report that lists the filename and error(s) like so

Code:
FILEA.TXT Button3320err
FILEB.TXT USB3235err
FILEC.TXT IR Remote2436err
FILED.TXT No error

Is it possible to return "No error" with the file name without error?

View 11 Replies View Related

General :: Shell Script To Prompt For Input

Jun 14, 2011

I would like to run some existing scripts and send it to a text file:

Note: 'script' is an exist shell script
Note: '/opt/2011jun15/my.db' auto generates everyday with only changes to the directory 2011jun15 base on the current date

currently i will need to run the script manually and make changes to the path below, change directory name 2011jun15 daily and text file new2011jun15.txt ./script -f /opt/2011jun15/my.db > new2011jun15.txt

Am i able to write a shell script to prompt me for a change of path for only '2011jun15' and 'new2011jun15.txt'?

It will be great if i can automate the whole process?

View 11 Replies View Related

Programming :: Bash Scripting - Taking User Input And Adding It To A Particular Area Of A File?

Jan 12, 2010

in bash scripting...say I want to take the input from a user via a question...I would do this:

Quote:

#!/bin/bash

echo "How large do you want this partition to be in GB (enter only the number)?" read PART_SIZE echo "You want your partition to be $PART_SIZE GB" But I don't want to echo it back to the screen, I want to add it to the content of /etc/fstab. I have been mucking around with sed to find the tmpfs partition in /etc/fstab and add the partition size attribute (this is to use the onboard RAM as a volatile partition)...but am not having any luck...

The portion of /etc/fstab that uses /dev/shm for the tmpfs partition is:

tmpfs /dev/shm tmpfs defaults 0 0

So, if a user says "24" GB to the answer (from above), how do I get it to automatically add that value to the tmpfs partition line in /etc/fstab? So it would look like:

tmpfs /dev/shm tmpfs size=24g,defaults 0 0

I understand that I would also have to come up with a way to put "size=XXg", which I could do with a copied over generic file before this action...then the script would have to find "XX" and replace it with the user's figure...

View 7 Replies View Related

General :: Write A Shell Script That Allows Only User 1 And User 2 To Execute A Program?

Feb 25, 2010

I've looked everywhere but I can't find where to change the default box for incoming mail, or am I on the wrong track. It's a nuisance having to change folders and I can't configure wastebin to empty on exit.And I can't get kmail to import from evolution. Do I have to go to the evolution storage and do it manually, and if so, how do I do that?

View 1 Replies View Related

General :: Login As Other User Using Shell Doesn't Load The Profile For That User?

Dec 11, 2009

I am using the sudo command to log on locally as another user by the following command:

sudo -u theotheruser -s
or
sudo -u theotheruser sh

As I see it, this initiates a new shell with the mentioned other user.However, this doesn't load that users profile from his home directory.Is there a way to automatically read the users profile when login in with selected command? I am mostely interested in getting a working prompt when logged in.

View 11 Replies View Related

Ubuntu Networking :: Terminal Command/script To Upload A File To An Ftp Server Without User Input?

Apr 26, 2011

I've got used to using the ftp command from the terminal, which is useful, especially with macros. But it requires user input, and what I want to do now is upload a specific file to a server, once I've finished working with it every day. It's the same file every day. II would like to be able to do this semi-automatically: I just give the command and it connects to the server and uploads the file. (I will probably want to encrypt the file before uploading it.)I don't know how I could use ftp without any user input: I want it to be automatic.

View 5 Replies View Related

General :: Shell Scripting: Getting Multiple Input Files For An Application?

Sep 21, 2010

I am running an application called QuantiSNP [URL]. The binary file is "quantisnp2", called upon in the "run_quantisnp2.sh" supplied by the authors. I am only able to run the application for single file processing (e.g. 1 input file for 1 sample; I can't run the batch file processing because I don't have the necessary BeadStudio report files, which has different formatting for the input files).

The difficulty is that I have 300 samples (300 unique sample IDs) and 3 input files for each sample for a total of 900 runs of this application. I am wondering how would I be able to automate this process as a shell script instead of basically manually changing the sample ID and respective input files every time a run completes? I bolded the single file processing shell script command line options below that need to be changed for each sample/input single file processing run. The command line option "--sampleid" is for the name given to the processed output files corresponding to the sample of interest and there are 3 input files for each sample.

/home2/jason/QuantiSNP/quantisnp/linux64/run_quantisnp2.sh /home2/jason/QuantiSNP/MCR/v79/ --config /home2/jason/QuantiSNP/quantisnp/config/params.dat --levels /home2/jason/QuantiSNP/quantisnp/config/levels-affy.dat --outdir /home2/jason/QuantiSNP/quantisnp_out/ --sampleid sample1 --gender female --input-files /home2/jason/files/sample1_input.txt

Note that each sample has 3 input files, for a total of 3 runs of "quantisnp2" for each sample. e.g.

SAMPLEID INFILE
sample1 /home2/jason/files/sample1_input.txt
sample1 /home2/jason/files/sample1_input2.txt
sample1 /home2/jason/files/sample1_input3.txt

[code]....

View 7 Replies View Related

General :: Socat And Rich Terminals - No Job Control In This Shell

Mar 24, 2010

socat - exec:'bash -li',pty,stderr,ctty -> bash: no job control in this shell

What options should I use to get fully fledged shell as I get with ssh/sshd? I want to be able to connect the shell to everything socat can handle (SOCKS 5, UDP, OpenSSL), but also to have a nice shell which correctly interprets all keys, various Ctrl+C/Ctrl+Z, tab completion, up/down keys (with remote history).

- Found "setsid" socat option. It fixes "no job control". Now trying to fix Ctrl+D.
- socat file:`tty`,raw,echo=0 exec:'bash -li', pty, stderr, setsid, sigint, sane. Not it handles Ctrl+D/Ctrl+Z/Ctrl+C well, I can start Vim inside it, remote history is OK.

View 1 Replies View Related

Software :: Calling DB User From Separate File In Shell Script?

May 23, 2011

I need to execute a SQL via shell script and i am connecting to Oracle DB by this way $USERNAME1/$PASSWORD1@$STRING1 and i need to get username, password and string from someother file stored in the Unix Directory. $Username, $Password and $String is stored in File A in Path A and i want to call it in the test.sh in Path B.

Format of File A.txt
Username=test_db
Password=*****
Instance=ORACLEDB

View 3 Replies View Related

General :: Get User Input Into A Script ?

Nov 5, 2009

I have a section of a script that is supposed to change the filename of similar files in a directory. It works the way I need it to work, except that I would like to input the new filename each time it runs without having to edit the script.

I capture 5-6 images into ~/screenshots. They are labeled Picture 1.png, Picture 2.png, etc. I would like to be able to rename them as Lesson 1.png, Lesson 2.png, and so forth. It works if I hardcode the new NAME (Lesson) into the script, but I want to replace NAME with a variable that I can input at a prompt or pass into the script from another. I have tried setting a variable and replacing "Lesson" with $variable in line #11, but that leaves me with only the extension and no filename.

I have also tried using $1 on the command line:

Here is what I have that works:

How do I get a variable into this script?

View 2 Replies View Related

Programming :: Fetching Return Value From Shell Script?

Jul 12, 2010

from paul's reply in the link (http://www.linuxquestions.org/questi...c-code-181152/) , I am trying to retrieve the count from a shell script using option 1: below is the system call that I have used to call my shell script named "test"

Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
i=system("./test 1234");

[Code]...

Here "test" is the shell script that is fetching the count from a table for a particular column("1234") that I am passing as the parameter. When the "test" script alone is run, it is returning the correct count but when trying to check through the C program it's returning some different value. How can I get the exact value from the script in my program above?

View 10 Replies View Related

General :: How To Get Invalid User Input Into Variable?

Apr 8, 2010

I have a script in which it searches the password file for a username based on the user's input. Is there a way I can take the bad input and keep it in a variable. (one that keeps adding all the non-existent users)so how would I get non-existent users into another variable?

View 9 Replies View Related

General :: F13 - How To Use VNC To Control User Desktop

Jul 26, 2010

I have fedora 13 64bit installed on the box I want to connect with vnc, I have tigervnc & tigervnc-server installed.
As my user I run:
vncserver
then I can connect to that box using: 192.168.1.2:1 but it is a different desktop?
How can I use vnc to control my user's desktop?

View 1 Replies View Related

Ubuntu :: Super Basic Shell Script - Cannot Get Return Line

Jan 24, 2011

I'm trying to create a super simple shell script, but I cant get a return line. The shell script looks like this (only the part that matters)
Code:
yes '' | ssh-keygen
The idea being it will put in a blank char. Then enter until the program finishes. The problem is, it only does the first time, the next 2 times I have to hit enter, it requires me to input it manually (which is exactly what I'm trying to avoid).

The full script (if you care):
Code:
#!/bin/sh
# Created by Omega
# First, program creates RSA key, named id_rsa and id_rsa.pub
# Second, program send the public code to requsted server.
echo 'Removing old id_rsa key (if applicable)'
rm -rf ~/.ssh/id_rsa.pub
rm -rf ~/.ssh/id_rsa
echo "Creating RSA key"
yes '' | ssh-keygen

# Checking if ssh-kkeygen created requested file
if [ -e ~/.ssh/id_rsa.pub ]
then
echo 'Done'
echo 'Username and Server in: me@server format'
read var1
echo 'Port Number? If standard put 22'
read var2
ssh-copy-id -i ~/.ssh/id_rsa.pub "-p $var2 $var"
else
echo ''
echo 'ERROR, ssh-keygen did not execute correctly'
echo 'Retrying...'
echo ''
echo 'Please leave all options default (just press enter)'
ssh-keygen
if [ -e ~/.ssh/id_rsa.pub ]
then
echo 'Done'
echo 'Username and Server in: me@server format'
read var1
echo 'Port Number? If standard put 22'
read var2
ssh-copy-id -i ~/.ssh/id_rsa.pub "-p $var2 $var1"
else
echo 'ERROR, ssh-keygen did not execute correctly'
echo 'Quitting'
exit
fi
fi
# End

View 2 Replies View Related







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