General :: Getting The While Loop To Execute In The Ssh Command?

Jun 15, 2011

I am having trouble getting the while loop to execute in the ssh command:ssh $USERID@serverX "while read line do echo $line done<$list_dir/cost_feed.lst.old"Error:bash: -c: line 1: syntax error: unexpected end of fileI have managed to use simpler commands with ssh like:ssh $USERID@serverX "pwd; cp x y"I expect that I need to add some combination of escape characters or semicolons

View 3 Replies


ADVERTISEMENT

SUSE :: Automate Execute Command, Reboot And Execute Command?

Dec 1, 2008

Is there a way to execute some command and then after the command completes utomatically reboot the system and then after the system reboots execute another command ? For example look at the sequence shown below(1) Execute command-1(2) After the command-1 in (1) is completed,reboot the system (3) Execute command-2(4) After execution of command-2 reboot the sytemIs there a way i can automate this process so that i need not reboot the system manually

View 5 Replies View Related

Programming :: Unable To Execute FOR Loop In Shell?

Apr 19, 2011

hint me why and how to execute the below for loop, the way i am trying to?

[bkcreddy17@local:~]$ cat -n test
1 date
2 ls -l

[code]...

View 14 Replies View Related

General :: Only Execute 2nd Command On Successufl Execution Of 1st Command?

Aug 19, 2009

I have a script which builds a project and then runs junit tests. However, if the build fails, the junit tests fail with the same error message.Therefore the command which runs the junit tests should only be executed if the build was successful.

View 3 Replies View Related

Ubuntu :: Loop Through Subfolders And Execute Commands Or Scripts?

Apr 3, 2010

Let's say I have 4 subfolders in the folder test as shown below:

drwxr-xr-x 2 muskedear muskedear 4096 2010-04-03 17:11 sub001_p1
drwxr-xr-x 2 muskedear muskedear 4096 2010-04-03 15:38 sub002_p1
drwxr-xr-x 2 muskedear muskedear 4096 2010-04-03 15:38 sub001_p2
drwxr-xr-x 2 muskedear muskedear 4096 2010-04-03 15:38 sub002_p2

I want to loop through the folders and check if they end with *_p1 or *p2. If a given folder ends with *p1, I want to cd to that folder and manipulate certain files in that folder. If the folder ends with *p2, I want to perform different manipulations on certain files.

View 1 Replies View Related

General :: Write A Loop Command For Pdf2djvu?

Jun 25, 2011

How do I write a loop command to periodically check a given folder and then create a djvu file from any pdf it finds.pdf2djvu works great but I'm looking to set up a "hot folder" for general office staff to use.

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 :: Writing A Command (for Loop) That Would Ping A Class C Subnet?

Nov 4, 2010

how to write a command (for loop) that would ping a Class C subnet to make it so that it only replies once and does not show the statistics?

View 2 Replies View Related

General :: Bring Back The Command Prompt When Running An Infinite-loop Containing Program?

Jan 13, 2010

When running a program that has infinite loops in the terminal , how to bring back the command prompt ? ( I'm using Fedora core 5 )

View 7 Replies View Related

General :: Execute A Command Whenever A File Changes?

Aug 27, 2010

I want a quick and simple way to execute a command whenever a file changes. I want something very simple, something I will leave running on a terminal and close it whenever I'm finished working with that file. Currently, I'm using this: while read; do ./myfile.py ; done And then I need to go to that terminal and press Enter, whenever I save that file on my editor. What I want is something like this: while sleep_until_file_has_changed myfile.py ; do ./myfile.py ; done

Or any other solution as easy as that. BTW: I'm using Vim, and I know I can add an autocommand to run something on BufWrite, but this is not the kind of solution I want now. Update: I want something simple, discardable if possible. What's more, I want something to run in a terminal because I want to see the program output (I want to see error messages).

View 7 Replies View Related

General :: Execute Ssh Command Without Password?

Oct 3, 2010

How do I set up SSH so I don't have to type my password? i execute the following command ssh -l admin hostname command but each time i execute it, it ask me to enter password.how i can give it password as default because i'm going to put in bash file ?

View 2 Replies View Related

General :: Execute A Command After Sudo?

May 4, 2011

I am working in a CentOS environment with numerous CentOS machines. Currently there are multiple developers that each have their own login/home directory and then for various admin tasks we all share a single super user account.

The problem

I have a number of aliases, variables, functions, and settings that exist in my personal login's .bash_profile. None of these are available in the shared super user's .bash_profile. My current work around is that everytime I sudo in as the super user and I re-execute my .bash_profile from my personal user's home directory. I am not allowed to edit the init stuff for the super user

The Question

Is there any way I can automate my sudo sequence such that it will execute my personal .bash_profile after I've executed sudo without requiring me to edit the super user's bash init stuff?

View 3 Replies View Related

General :: Execute A Command In A Link?

Jun 30, 2011

When i click in one icon (for example), this icon executes "java -jar ...". In another words: Make a .exe on linux.

View 2 Replies View Related

General :: Unable To Execute Top And PS Command

Jul 29, 2010

Top: error while loading shared libraries: libproc.so.2.0.6: cannot open shared object. I am not able to execute top and ps command.

View 6 Replies View Related

General :: Way To Execute Top Command Once And Exit ?

Jan 6, 2010

Is there a way to execute top command once and exit...i.e. stop refreshing window and continue console without pressing 'q' or 'ctrl+c'...

View 3 Replies View Related

General :: Using 'say' To Login SSH And Execute Command

Mar 25, 2010

My problem is:

sub init() {
$Test->description("Establishing the connection to the client");
eval {
$Host = host($CLIENT) or die($@);
$Conn = connect("#ssh") or die "Client connection Failed" . $@;
};
if ($@) {
$Log->error("Unable to instantiate the Objects for the Test" .
[Code]...

Here I'm trying to connect windows machine using connect object which is working fine. But when I tried to execute the command on Windows machine from Linux machine by using:

[Code]...

View 1 Replies View Related

General :: Execute A Command When Power Source Changes

May 20, 2010

My laptop has a dead battery. Even when it's fully charged, if the power cable is pulled out it only lasts for about 4 minutes before it dies. I'm running Ubuntu Lucid Lynx 32-Bit. What I want to do is create some sort of script or program that will immediately set my computer to go into hibernation once it detects that the power cable has gone dead. I'm willing to look into all ways of doing this. I can program in C, but I'm not familiar with the API used to manage Power Management in Linux.

[Code]...

View 5 Replies View Related

General :: Execute Root Command Without Sudo?

Jan 24, 2010

On my ubuntu I have a command pm-suspend, which puts the computer to sleep. It has to be run with sudo. Since it is inconvenient to be forced to type the password every time I want my computer to sleep, I thought maybe there's a way around it. Naively I thought that if I'd create a script as root, that invokes pm-suspend, and then let anyone execute that script, I could run that script as my own user and then that script would be considered run by root and hence be allowed to run pm-suspend. Obviously that didn't work. The root-check procedure in pm-suspend still found out that the original executor was someone different from root.

Still I think something similar (although slightly more elaborate) should work.I'm thinking about the process that allows the user to mount hard drives for example. Normally root is required, but it is somehow bypassed by the gnome utility mounting.

View 8 Replies View Related

General :: How To Execute Permission To Chmod Command

Apr 14, 2011

How can I give execute permission to chmod command from run level 3.Because in GUI mode we have the execute option in the properties of file. E.g. I gave following command
chmod -x chomod
After that I want to give the execute permission (x) to chmod command again but how from command prompt?

View 5 Replies View Related

General :: Execute -depth In Find Command?

Apr 23, 2010

within my bobje directory, I have many directories and some log files . I want to delete those log files without traversing the subdirectories. so i performed these commands and getting the mentioned errors.

[Code]....

View 8 Replies View Related

General :: For Loop Or While Loop To Read The Fields Of A File?

Sep 1, 2010

I have a mytext file with month and year as two separate fields. likemytext fil

08 2010
09 2010
10 2010
........
........
........

I want to read the values of each field i.e., month and year into an awk script.

View 10 Replies View Related

General :: Execute A Command On X-session Owned By Another User?

Jul 13, 2011

Is possible (by root of course) to run a command from console, that will be executed on X-session owned by another user on the same linux box/machine ? Example: Can root open xclock for another local user logged into X11 ?

View 2 Replies View Related

General :: Execute Command Inside First Directory Of Each Matched Result?

Aug 8, 2011

I am working at a client who has a project where code is a mixture of different source control systems. So a layout might be like this

project/a/.svn
/a/subfolder/.svn
/b/.hg
/c/subproject/.svn
/d/.hg

So I am trying to put together a simple command that when executed from the project folder will run the appropriate hg/svn command in each project i.e:

[Code]...

Since the client has many such projects, Instead I am looking for a solution similar to find -exec where the svn/hg commands are automatically executed on each first level of match (i.e. svn up is run in the project/a folder but not in project/a/subfolder). How can such a command be constructed ?.

View 1 Replies View Related

General :: Execute My Scripts (example.sh) Files Like Other Normal Commands From Command-line?

Jun 23, 2010

I just want to know that how can I execute my scripts (example.sh) files like other normal commands from command-line. Please describe the full method

View 5 Replies View Related

General :: Setup A System To Allow Normal Users To Execute A Command Without Using Sudo?

Jan 5, 2011

I am trying to setup a system to allow normal users to execute a command without using sudo. Is this possible?

View 6 Replies View Related

General :: Command To Compile And Execute Fortran Program On System Machine?

Apr 8, 2010

Command to compile n execute a Fortran program on a Linux machine

View 6 Replies View Related

General :: Script To Execute A Command Based On The Last Modified Time Of A Folder

Oct 19, 2010

I need a script that executes a command based on a folder's last modified time.

if "/var/data" was modified in less than an hour then "/usr/local/etc/searchd stop" should be run

can we use "find -mmin +60 -type d" in conjunction with second command

View 1 Replies View Related

Programming :: Effect Of Using Eval To Execute A Command As Opposed To Writing It On The Command-line?

Jun 18, 2010

Code: cmd='date | wc'

$cmd If this script is executed, an error is generated. The reason written was that "The execution fails because the pipe is not expanded and is passed to date as an argument".What is meant by expansion of pipe. When we execute date | wc on the command line, it goes fine.then | is not treated as an argument. Why?

View 4 Replies View Related

Ubuntu :: BASH: Execute Next Command Until Another Command Succeed?

Mar 19, 2010

I have a big bash script ,its goal is to download movie one by one . But I often get into a problem: if this script is executed in cron,it often does not completely download the movie.I often find the movies it downloaded are several KB while the movie is actually 20MB.So I think it is because it did not wait for finishing one task ,and jump to download another.So I want to know ,is there a way to force the bash script to wait until one movie downloaded completely and then start to download another movie ?

View 8 Replies View Related

Ubuntu :: What Is Loop For In Command Line?

Aug 23, 2010

what does desktop manager do? What does $ do? what is loop for in command line? What is the best way to switch user? Using command line?

View 7 Replies View Related







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