Sponsored Content
Top Forums Shell Programming and Scripting How to run a script using batch file? Post 302556058 by Corona688 on Friday 16th of September 2011 12:22:52 PM
Old 09-16-2011
DOS CMD is not UNIX sh. $ doesn't give you a variable.

It only took MS 20 years, but they did finally add a method to read from keyboard:
Code:
@ECHO OFF

SET /p userin=Please enter your full name: 
SET /p pasw=Please enter your password:

plink.exe -pw %pasw% %username%@host sudo su - < script.sh

CMD being what it is, its treatment of spaces and quotes can be ambiguous. Spaces in passwords may not work and quoting may not be able to fix it.
These 2 Users Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can I run a batch daily

I am very very new in Unix. Thank you for your forum : many answers for my dummy questions ! Today, I have a script that works well. I want it to run daily. How can I do ? What can I search in man ??? Thank you in advance. A. MARTINEZ (3 Replies)
Discussion started by: annemar
3 Replies

2. UNIX for Dummies Questions & Answers

How can I run scripts in my unix account from batch file in Windows?

Hi all, I'm working on Windows, connecting to my Unix account by different ways: by FTP opening files in UltraEdit32, by mapping drive to browse, by Exceed or Telnet to compile at Unix account. Actually, that is what I would like to change: I'd like to make a batch file which would connect to... (7 Replies)
Discussion started by: olgafb
7 Replies

3. Shell Programming and Scripting

How to write a Script to run series of batch jobs on unix platform

Im new to unix shell scripting, I have to run batch jobs on unix. for example i have 5 jobs. first 2 can kickoff parallely. after completely finishing the 2 previous jobs the 3 job should kick off..once 3rd is over 4 th and 5th can kick off parallely. Each jobs run for 1 or 2 hours each. How to... (2 Replies)
Discussion started by: venki311
2 Replies

4. UNIX for Dummies Questions & Answers

How to create an run a simple batch file?

Hi, So, I created a file named TEST.BAT in my home directory. In it, I wrote: #! /bin/bash echo Hello and then, saved the file. Then, at the command-line interface, I typed TEST.BAT, but the command-line never executes the file and thus, never returns "Hello". It says "command... (2 Replies)
Discussion started by: Hyunkel
2 Replies

5. Shell Programming and Scripting

How to run VI in batch mode

Hi how do I use vi to do change some strings in a shell script loop 1. Run ls first, for each file that contains the word salesreport*.txt, do the following 2. use vi to run the following ex command : "1,$s/1975/1945/ig, wq" Please tell me how to do this in vi, not sed. Thank you. (5 Replies)
Discussion started by: grossgermany
5 Replies

6. Shell Programming and Scripting

help with email to be triggered based on fatal error detection from batch run log file neded

Hi, I require need help in two aspects actually: 1) Fatal error that gets generated as %F% from a log file say ABClog.dat to trigger a mail. At present I manually grep the log file as <grep %F% ABClog.dat| cut-d "%" -f1>. The idea is to use this same logic to grep the log file which is... (1 Reply)
Discussion started by: zico1986
1 Replies

7. Shell Programming and Scripting

Batch script to run in SFTP

Hello Guys, I am writting a script which is SFTPing from Solaris to Windows. I need to run a Batch script in SFTP session (ongoing) which will map a network drive and then transfer my files. I can run the Batch script via SSH but not via SFTP and this mapping is limited to that SSH... (4 Replies)
Discussion started by: Deei
4 Replies

8. Shell Programming and Scripting

To run a shell script in remote server from windows batch file

Hi all, i need to run a shell script on remote server. I have created file .bat file in windows server with following code, c:\Users\Desktop\putty.exe -ssh -pw password user@server ./script.sh i need to run the script.sh in my remote server Above command is not working, any... (4 Replies)
Discussion started by: rammm
4 Replies

9. AIX

How to write a script to run without password on a batch of servers?

I need run a command such as ps -ef |grep xxx on a batch of servers, how to write a script to run it without password? don't need go in each server to check? Thanks (7 Replies)
Discussion started by: rainbow_bean
7 Replies

10. Shell Programming and Scripting

Need to run the batch script from shell scripting

Hi All, I am working on shell scripting.My script is completed but I have one task that is to trigger the batch script(with or without parameter) from my shell scripting(reside on linux system) and output which is geneareted by the batch should e.g. if batch script creates any files then I want... (5 Replies)
Discussion started by: anuragpgtgerman
5 Replies
UPSRW(8)						      Network UPS Tools (NUT)							  UPSRW(8)

NAME
upsrw - UPS variable administration tool SYNOPSIS
upsrw ups upsrw -h upsrw -s variable [-u username] [-p password] ups DESCRIPTION
upsrw allows you to view and change the read/write variables inside your UPS. It sends commands via the server upsd(8) to your driver, which configures the hardware for you. The list of variables that allow you to change their values is based on the capabilities of your UPS equipment. Not all models support this feature. Typically, cheaper hardware does not support any of them. Run upsrw with a UPS identifier to see what will work for you. OPTIONS
-h Display the help message. -s variable Specify the variable to be changed inside the UPS. For unattended mode such as in shell scripts, use the format VAR=VALUE to spec- ify both the variable and the value, for example: -s HIGHXFER=129 Without this argument, upsrw will just display the list of the variables and their possible values. Some variables are strings, and can be set to any value within the length limit. Others are enumerated types and can only be set to one of those values. Refer to the list to know what's available in your hardware. -u username Set the username for the connection to the server. This is optional, and you will be prompted for this when using the -s option if you don't specify -u on the command line. -p password Set the password to authenticate to the server. This is also optional like -u, and you will be prompted for it if necessary. ups View or change the settings on this UPS. The format for this option is [upsname@]hostname[:port]. UNATTENDED MODE
If you run this program inside a shell script or similar to set variables, you will need to specify all of the information on the command line. This means using -s VAR=VALUE, -u and -p. Otherwise it will put up a prompt and your program will hang. This is not necessary when displaying the list, as the username and password are not required for read-only mode. DIAGNOSTICS
upsrw can't set variables on your UPS unless you provide a valid username and password. If you get "access denied" errors, make sure that your upsd.users(5) has an entry for you, and that the username you are using has permissions to SET variables. HISTORY
This program used to be called upsct2, which was ambiguous and confusing. SEE ALSO
upsd(8), upscmd(8) Internet resources: The NUT (Network UPS Tools) home page: http://www.exploits.org/nut/ NUT mailing list archives and information: http://lists.exploits.org/ Sat Aug 31 2002 UPSRW(8)
All times are GMT -4. The time now is 06:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy