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


ADVERTISEMENT

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

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

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 :: Shell Script Is Defined In Someother Directory - How It Is Being Invoked With Path

May 30, 2011

extract.ksh use this scripts topic_file_publish.sh but extract.ksh resides in /data/apps/pnbos/scripts

but topic_file_publish.sh in below directory/data/apps/pnbgstk/publication >

ls topic_file_publish.sh topic_file_publish.sh fraespappp8:/data/apps > type topic_file_publish.sh topic_file_publish.sh is hashed (/data/apps/pnbgstk/publication/topic_file_publish.sh)

How it is done?

since topic_file_publish.sh is being directly referenced in the code with absolute path.

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

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 :: 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

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

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 :: 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

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

Programming :: Run A User-defined Command Without Sudo ?

Jan 24, 2011

I wrote a shell script and was able to compile it using SHC. after that i copied it to the /bin folder and tried running it as a normal user, but i keep getting the error " operation not permitted killed "

I tried changing the permissions. but it doesn't work. it only works with sudo. there must be another way. otherwise it won't be linux right?

View 11 Replies View Related

Ubuntu :: Script To Setup Ufw With Ssh On User Defined Port?

Apr 3, 2011

Im writing up a script to set up ufw with ssh on a user defined port. I have 2 minor issues, 1, this script can only run once, from the defualt configuration files. if the config files are previously modified, this script will fail. So how can i fix it so that the line specifying port in the ssh_config file can be read and rewriten to numerous times.

I have alot of echo type commands. how can I neaten that up?

Code:
#If these aren't installed, install them now with:
#sudo apt-get install openssh-server denyhosts ufw
#This script is to help you set up decent security
#on your Linux computers. Run this script as root.

[Code]....

View 2 Replies View Related

Programming :: Including User Defined Header File?

Apr 29, 2011

i got a sample.c which generate a linked list for sorting according to the number generated. then i want to split the sorting function into a header file. and it looks like the sort function in the header file could not access the linked list in the main. the error is dereferencing pointer to incomplete type

sample.c

Code:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

[code]...

View 2 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 :: Call Putty/plink To Start A Remote SSH Script With User Input?

Jan 18, 2010

Execute putty to start a script on a remote linux server which requires user input The remote script does a read -p "Please enter name" NAME I can use plink to execute a script over SSH, the following attempts and problems are shown below :- Note the -load ns is to load a session that doesnt exist, ie ensure no defaults are used

1) plink.exe -load ns <ip_addr> -l <user> -pw <password> <script path/name> Problem) Doesn't allow/show user input, ie its non-interactive.

2) Add -t to allocate a pty :- plink.exe -t -load nc <ip_addr> -l <user> -pw <password> <script path/name> so now the user input can be seen, but I get Ctrl+H (^H) when backspace is pressed, ok if the user doesnt make a mistake!

3) Use putty instead with a saved session putty.exe -load "SavedSession" Get a new window opened, not a biggy, but not as nice. (b) saved session cannot be easily moved. (c) Get password prompt, cannot provide password like with plink, I know I know, use keys, but this is a closed, private network, and its easier not to bother with keys!I would like the SSH to execute in-line, that is from within the batch file/command line shell I am in, not prompt for username/password, run the linux script and allow prompts and delete/backspace to work.

View 5 Replies View Related

General :: Call Putty / Plink To Start A Remote SSH Linux Script With User Input

Jun 27, 2011

Seemingly simple question, which yields slightly undesired results. Execute putty to start a script on a remote linux server which requires user input The remote script does a read -p "Please enter name" NAME I can use plink to execute a script over SSH, the following attempts and problems are shown below :-
Note the -load ns is to load a session that doesnt exist, ie ensure no defaults are used

1) plink.exe -load ns <ip_addr> -l <user> -pw <password> <script path/name> Problem) Doesn't allow/show user input, ie its non-interactive.

2) Add -t to allocate a pty :- plink.exe -t -load nc <ip_addr> -l <user> -pw <password> <script path/name> Problem) Ok, so now the user input can be seen, but I get Ctrl+H (^H) when backspace is pressed, ok if the user doesnt make a mistake!

3) Use putty instead with a saved session putty.exe -load "SavedSession" Problem) (a) Get a new window opened, not a biggy, but not as nice. (b) saved session cannot be easily moved. (c) Get password prompt, cannot provide password like with plink, I know I know, use keys, but this is a closed, private network, and its easier not to bother with keys!

So ideally, I would like the SSH to execute in-line, that is from within the batch file/command line shell I am in, not prompt for username/password, run the linux script and allow prompts and delete/backspace to work.

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 :: How To Add User So That They Have No Shell Access?

Feb 18, 2010

Im want to know the command to add a user with no shell access so they cannot log onto the system, but there a user on there so for example they can be part of the email server.

View 2 Replies View Related

General :: How To Run Program As User With No Shell

May 27, 2010

I have a program I want to run as it's own user. But I don't want anyone to be able to login as that user, so I created a user like: -

useradd -s /sbin/nologin someuser

How do I run a specific program owned by this user as this user? I can't su to this user as it doesn't have a shell.

View 15 Replies View Related

General :: Send Message To Other User In Shell?

Jun 22, 2009

how can i send message to other user in shelli try use write before but it say permission deny from user

View 2 Replies View Related

General :: Unabel To Switch User Shell?

Mar 17, 2011

I have a big problem here.I have 2 shell windows, ne is a root shell and the other with some user account.If I change the root password in the root shell window aspasswd rootI can change it, but when I go into the user shell window, and I do "su" I cannot switch to root. Always "incorrect password".Same happen if I try to do "su <some-other-user>"This happen ONLY in shell windowws. If I try, for example, to run some administration service, like system-config-service, the root password is accepted in the prompting window.

View 6 Replies View Related

General :: Existence Of USER Environment Variable In The Shell?

Jan 28, 2010

I heard (although I can't find any sources for proof) that the USER environment variable may not be set in a old Unix shells (maybe even some obscure shells as well). What is the probability that it won't be set?

View 2 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 :: Shell Script For Printing User From /etc/passwd?

Oct 15, 2010

How we can take username from the /etc/passwd which have UID more than or equal to 500.

View 3 Replies View Related

General :: A Script For Deleting User , If He Has No Login Shell?

Nov 25, 2010

I want to create a script to delete user if he has no login shell.

View 4 Replies View Related

General :: Set Environment Variables For A Particular User On C Shell Configurations?

Jun 2, 2011

I have been give a task of replicating one of our production systems to create a test system. I have been restricted to use c shell to set up its environment variables. I am new to this my questions is how do i set environment variables for a particular user on c shell e.g ORACLE_HOME and ORACLE_SID permanently for a particualar user i know in bash you edit the .bash_profile file. What do i do for c shell?

View 2 Replies View Related







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