Program Does not execute


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Program Does not execute
# 1  
Old 10-14-2017
Program Does not execute

Hi there,

When I am trying to execute any shell script.
The shell script only execute line 1 and I notice that the rest o the program was not executed. Please advise.

Code:
[root:...ktop/Script-Order/0-restart]# bash +x vmscript-4.sh

Even when I enter this command there is not output.

Code:
sudo su
cd /tmp
cp /usr/lib/vmware/modules/source/vmmon.tar .
tar xf vmmon.tar
rm vmmon.tar
wget https://raw.githubusercontent.com/mkubecek/vmware-host-modules/fadedd9c8a4dd23f74da2b448572df95666dfe12/vmmon-only/linux/hostif.c
mv -f hostif.c vmmon-only/linux/hostif.c 
tar cf vmmon.tar vmmon-only
rm -fr vmmon-only
mv -f vmmon.tar /usr/lib/vmware/modules/source/vmmon.tar 
vmware-modconfig --console --install-all
echo 'Running'

This is the script I am trying to run.
It is not only this script. it is just about every other script there is.
# 2  
Old 10-14-2017
Does "every other script there is" also start with sudo su? That logs into another user, usually root, and waits for stdin. Once you terminate that session, your script will continue. You could offer commands / script on stdin, e.g. by a here document.
# 3  
Old 10-14-2017
Quote:
Originally Posted by RudiC
You could offer commands / script on stdin, e.g. by a here document.
Either this or (IMHO cleaner):

Code:
sudo su - root -c "/here/goes/the/command -args"

I hope this helps.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute a command after a program was launched

Hi Experts, I am creating a script to monitor a certain applications running in my Unix system. My script order goes this way: df -h /of/a/filesystem tail -5 /path/to/an/application/availability su -c "jsmon pf=(profile of my application) `echo "p"`" usradm #EOF I am... (7 Replies)
Discussion started by: Xworks
7 Replies

2. Ubuntu

I can't execute a C++ program, help!

My professor gave me a code with no errors. When I compile it's fine, it doesn't show any errors, but when I try to execute it shows this: line 3: syntax error near unexpected token '(' line 3: 'int main()' I searched through the Internet but I couldn't find any solution. Please!!!... (1 Reply)
Discussion started by: rosiiieee
1 Replies

3. Shell Programming and Scripting

Execute C program in Current shell

Hello, I have a c program executable which I need to run inside a shell script. But the c program runs in a subshell because of which all the actions done by the c program is not available to the current shell. Is there any way to execute a C program binary executable in the current shell? (4 Replies)
Discussion started by: sachinverma
4 Replies

4. Shell Programming and Scripting

Execute a C program from Shell

Hi I want to create a shell script tha executes a C program and then retrieves information about it. I managed to run the program with: #!/bin/bash gcc -o program program.c ./program Now i want to get the id of the process (pid) Any help would be appreciated, Thank you (18 Replies)
Discussion started by: nteath
18 Replies

5. UNIX for Dummies Questions & Answers

how to execute program without using ./ or sh

Hi, I am a complete newbie for unix. I have just installed mysql on my MAC. I was wondering every time I wanted to use mysql I had to ./mysql or sh mysql everytime on /usr/local/bin/mysql/bin. How can I execute the mysql program without using ./ or sh. I chmod +x already. And what do I have to... (3 Replies)
Discussion started by: noppanit
3 Replies

6. Programming

C program to execute shell script

Hi, Can anyone give me a sample code to execute shell script from C program. Thanks (6 Replies)
Discussion started by: baigmd
6 Replies

7. Shell Programming and Scripting

C program to execute shell script

Hi, Can anyone pls give a sample to execute a shell script from C program Thanks (2 Replies)
Discussion started by: baigmd
2 Replies

8. UNIX for Dummies Questions & Answers

Script to open program and send/execute command in program

Hi, i want to write a script that executes a program (exec?) . this program then requires a filename as input. how do i give it this input in the script so the program will be complete run and close by the script. e.g. exec prog.exe program then asks for filename "enter filename:"... (1 Reply)
Discussion started by: tuathan
1 Replies

9. Shell Programming and Scripting

how to execute this program?

Filesystem 1024-blocks Free %Used Iused %Iused Mounted on /dev/hd4 32768 16016 52% 2271 14% / /dev/hd2 4587520 1889420 59% 37791 4% /usr /dev/hd9var 65536 12032 82% 518 4% /var /dev/hd3 819200 637832 ... (1 Reply)
Discussion started by: sathyaac
1 Replies

10. Programming

execve to execute a program

I tried using the following code to execute a program but it doesnt seems to be working .. I would like to know whats wrong wit it . execve("/bin/cat", "words", NULL); (0 Replies)
Discussion started by: winsonlee
0 Replies
Login or Register to Ask a Question