Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Type the following in an terminal to find what the path to ksh is:
Code:
which ksh
And change the first line in the first script accordingly. And why are you showing the contents of the script on the remote side, then cd into the directory and execute the script? What's your goal here?
Kind regards,
Eric
---------- Post added 28-03-11 at 11:18 ----------
Hi,
This seems very strange to me:
Code:
#!/bin/bash/ksh
Type the following in an terminal to find what the path to ksh is:
Code:
which ksh
And change the first line in the first script accordingly. And why are you showing the contents of the script on the remote side, then cd into the directory and execute the script? What's your goal here?
[root@host /]# which ksh
/usr/bin/which: no ksh in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
remote server
Code:
[wlsdev:/some/folder]which ksh
/usr/bin/ksh
so i need to change it in #!/usr/bin/ksh in stead of #!/bin/bash/ksh ?
I'm doing that just because of testing, if i do those commands and they are working, then i know that the next command normally also need to work.
EDIT:
it's working ;-)
thanks for putting me in the right direction.
Can you explain what those /usr/bin/ksh and /bin/bash are? and what the difference is between them
thanks again ^^
Last edited by brownie_cookie; 03-28-2011 at 04:28 AM.
You call your shell to use with your script in the first line of that same script. If you're using Bash then you should change it to /bin/bash (or whatever your distro uses, find out with the which command as you did for ksh). The 'working' of your commands depends on the shell you're calling. Korn shell doesn't work exactly the same as Bash, parameters are different or non-existent and so on.
now i'm going to write a document for myself how to make the scripts, so can look back at it when i don't know it anymore, and maybe also for the people here when i'm gone.
when that's done, i'm going the expend my scripts to what it has to do ;-)
THANK YOU VERY MUCH for helping me !!
and again, when i have any question, you'll find it here but i think i can go a long way from now on
Glad to hear you've got it! And documenting what you do is good practice, congratulations on that. You're welcome for the help, that's the whole meaning of LQ, helping each other out with Linux. Have a nice day/week.
i'm sorry but i came up with another problem/question
when i run my script on the remote server (locally, so without the ssh, because i copied it with scp), i get some results (because of the grep) and i put them in a variable (look code above). but how can i give these results back to the local server (not the remote server)?
Normally you should get the output of the ssh user@host 'command' on your screen. What are you getting if you're getting any information. Try one command at a time in the '' and see if you get any output. Try with a command you're sure that will generate output like ls -al. I'm not familiar with HP-UX so a good idea would be to connect to the server and execute the commands locally to see what you get.
on the local server, i copy my small test script (with scp) to the remote server, then i execute the small script.
the small script looks for an ERROR or WARNING in a certain file.
that's working, in my console i see this happening.
So the next stap would be, that e.g. if there is an ERROR i should get back a 1 (one) from the REMOTE to the LOCAL server, so i can interprete this 1 (one) as an ERROR so i can send a notification.
how do i get back the 1 (one)?
it doesn't has to be specifically a 1 (one), just something that i get back from the remote server so i can do something with it.
Perhaps your answer is the same as your answer to this question, but i think it's more clearly now what i'm trying to do
Why do you copy a script over and then execute it? Is there any reason besides maybe the fact that the remote machine is a HP-UX for not putting everything in one script?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.