General :: Running Executable In Bash Script
Mar 27, 2011
I've been trying to write a bash script called runSorter.sh that runs an executable that also takes in some parameters and outputs the results to a text file. The executable, sorter, takes in a number parameter. I want to make it so that you can input as many number parameters into runSorter.sh as you want and it will run the sorter executable for each one. So far, what I have looks like this:
#!/bin/bash
args=("$@")
INDEX=0
if [ -z args ]; then
echo "Error"
else
while [ $# -gt $INDEX ]; do
NUM=${args[$INDEX]}
echo $NUM
echo ./sorter $NUM
let INDEX=INDEX+1
done
fi
My problem is that when I run ./run-sorter.sh 100 on my terminal, it just prints this to the screen:
./sorter 100
How can I have so that it properly executes sorter and outputs everything to a text file?
View 4 Replies
ADVERTISEMENT
May 9, 2011
I downloaded a program called tonespace http://www.mucoder.net/en/tonespace/ which I extracted and then tried to execute the executable file with ./tonespace. This gives me the following message:
bash: ./tonespace: No such file or directory
When I use the command: file ./tonespace I get this: tonespace: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
I dont get it. The file is clearly there, yet when trying to execute it bash doesn't seem to recognize it.
It has permissions rwxr-xr-x and is not owned by root. Am I overlooking something?
View 2 Replies
View Related
Aug 4, 2010
I have created some text executable files and put them on my desktop. In the way of background I created them in gedit. Then used chmod ugo+x (filename) to make them executable. One of them is a ping test to see if a printer is on. Text in file = ping 192.168.1.5. Others are to turn my laptop touchpad on and off. text in file = sudo modprobe -i psmouse.
I have 2 questions about executable text files:
- When I click on an executable text file it present a window with 4 options (Run in terminal, display, cancel, run). Can I set a parameter or do something else so it just runs in terminal? I know I can set an option in Nautilus to run them but when I select run nothing seems to happen. In addition I would want to set this option on a case by case basis not globally in Nautilus. If there is an option or flag where it would run this file in terminal I would use it on my printer ping test.
- When I click on these executable text files to turn my touchpad on and off, the text within the file uses the sudo command so that requires that I input my password. After I click on either of these files a window appears with the 4 options (Run in terminal, display, cancel, run). I select run in terminal, a terminal window opens and requests my password. Subsequent to inputting my password the file executes fine.
Is there a way to set a parameter or do something else so I don't need to not only select the run in terminal option from (run in terminal, display, cancel, run) but also not to enter my password?
View 4 Replies
View Related
Dec 2, 2010
I need to run an executable from initramfs which after executing should restart the system. How is it possible?.I tried using exec within the init of initramfs but it shows kernel panic (I guess exec after executing the binary it tries to exit and exiting with pid 1 is giving the panic).
View 2 Replies
View Related
Jul 17, 2010
below are the details of my system. I have bash as my current shell, some really common commands aren't working.
Do I need to do a re-installation of bash? Or how do I install a selection of bash commands which I need? (for example a subset of [URL])
Code:
root@sdptfw:~ # uname -a
Linux sdptfw.sdpt.co.za 2.4.36 #1 Tue Jul 22 13:13:24 GMT 2008 i686 i686 i386 GNU/Linux
root@sdptfw:~ # echo $SHELL$
/bin/bash$
[Code]....
View 13 Replies
View Related
Jul 26, 2010
I presume there is something in the JWM window manager - or Puppy Linux Lupu 5.01 itself that is conflicting with the normal loading of GMPLAYER....
I would like to know how to troubleshoot, and fix this problem if possible (even a workaround would be great).
View 1 Replies
View Related
Sep 3, 2010
I am trying to run Wattch simulator in linux.But it is giving the error below. what is this error and what do I do about it?
fatal: bad magic number in executable `prime' (not an executable?)
View 1 Replies
View Related
Jan 19, 2010
SO I'm not talking about changing the file permissions, The only thing I could find on google was this [URL]Basically can you convert your bash script into a executable file, One that you can't open in text editor?
View 2 Replies
View Related
Apr 20, 2011
you can make a file that runs the contents as if typed out by the user in command prompt by saving the file as either .bat or .cmd . When using BASH in ubuntu, is it possible to save terminal executable files (from a text editor, like GEDIT), What file ending does it take, can i lay it out with just commands? (what is the syntax)
View 3 Replies
View Related
Apr 5, 2011
I need to instal JDownloader, I downloaded as a linux version and this is the command line output (Archive Manager):
Archive: /root/Downloads/JDownloader/JDownloader.exe
[/root/Downloads/JDownloader/JDownloader.exe]
End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive.
zipinfo: cannot find zipfile directory in one of /root/Downloads/JDownloader/JDownloader.exe or
/root/Downloads/JDownloader/JDownloader.exe.zip, and cannot find
/root/Downloads/JDownloader/JDownloader.exe.ZIP, period.
View 9 Replies
View Related
Jun 12, 2010
I'm new with linux, and I'm wondering why in order to run executable after compilation I have to type
>"./executableName" I want it to type it just like
>"executableName" (with no "./")
I don't know if this matters but I'm using tcsh for my shell...
View 6 Replies
View Related
Mar 12, 2010
I have a hardware audit script I want to run on several remote machines around my office. Is there a way to run the script that resides on my machine via ssh or do I need to copy the script to the local machine and then run it...
View 4 Replies
View Related
Aug 1, 2010
I would be running SQL commands (UPDATE/SELECT) from within my bash script. I am completely new to this subject. Is MYSQL used for this purpose? Alternatively, what is sqlplus?
View 6 Replies
View Related
Mar 17, 2011
I cannot run executable files from my home folder. I just double click it and it doesn't do anything.
View 1 Replies
View Related
Apr 16, 2010
I know I have to count how many instances are running: ps x | grep apache2 | wc -l result if it's running: 2, or else: 1 I also know there is a command called test that I could use to perform the verification, but I don't know how to use test with wc
View 3 Replies
View Related
Nov 2, 2010
I've got this simple script called test1, which I'm trying to execute in a bash shell using ./test1
Code:
#!/bin/tcsh
echo 'Hello world!'
[code]....
View 3 Replies
View Related
Apr 3, 2011
so I wrote a small script that pretty much just takes in two numbers and counts from the first to the second, e.g.
unknown-hacker|544> count.sh 1 3
1
2
3
My problem is I want to make it so that if you input invalid parameters, such as non-numerical characters, more than 2 numbers, etc., you'd get an error message
View 15 Replies
View Related
Nov 25, 2010
I am a newbie in linux. I tried to write an autorun bash script on /root and select System-Preferences-More Preferences-Sessions-Startup Programs-Add.But the bash script seems like not working. Following is my bash script:
#!/bin/bash
#
#chkconfig:345 99 99
[code]...
View 8 Replies
View Related
Aug 16, 2010
How can I check which version of bash I'm running
View 2 Replies
View Related
Nov 13, 2010
I have a bash script that messages the user periodically. Is there any way in the script to check if the screensaver is running, so the script doesn't spam messages while the user is away? The xscreensaver process is always running in the background, I've noticed.
View 5 Replies
View Related
Oct 8, 2010
I have a PGP script that for whatever reason if I let linux's cron run it automatically, it sends out the final email with attachment with a blank file. If I come in and run in manually everything works fine and the file is populated in the file. So the only real difference is that i'm running it manually through cron, rather than letting cron run it at a set time.Below is a sumary of my script.
Code:
#! /bin/bash
#PGP Decryption Bash Script
[code]...
View 6 Replies
View Related
Nov 10, 2010
I checked the 'Run executable text files when they are opened' option in Nautilus preferences. I have noticed that files such as .sh and .bin launch by simply clicking on then (which is great). However I have also noticed that an ordinary .txt and .html file must not be marked as executable in order to launch it in Gedit and Firefox respectively via clicking. Otherwise you must right click and open with every time. What file types need to have execute permissions? What file types never need to have execute permissions?
View 2 Replies
View Related
Mar 3, 2011
I have an executable with input options, like so:
Code:
./executable -n 42 -s 42
I've added gcov to the makefiles (compiling with --coverage, -fprofile-arcs, and -ftest-coverage, and linking with -lgcov). It builds fine and creates executable.gcno.
When I try to run gcov, gcov things the options belong to it:
Code:
$ gcov ./executable -n 42 -s 42
gcov: invalid option -- 's'
Usage: gcov [OPTION]... SOURCEFILE...
When I use quotes this happens:
Code:
$ gcov './executable -n 42 -s 42'
executable -n 42 -s 42.gcno:cannot open graph file
The command line options must remain. How can I get gcov to generate the same .gcno file it later looks for?
View 2 Replies
View Related
May 5, 2011
Despite the history file is unique (~/.bash_history) I see that the multiple bash processes run on different windows are not all updating that file. I presume that the bash is not taking into account this possibility (multiple bashes on multiple windows) and writes thus the history file in a simple straightforward way. This would mean that a number of history entries are lost. I've tried to find information but had no luck so far.
View 1 Replies
View Related
Feb 7, 2010
I am using Sphinx search on my webserver and it quits after a certain amount of time leaving my search page broken.Here is a bash script that I want to run every 10mins via cron:
Code:
#!/bin/bash
if pgrep searchd | grep "[0-9]"
[code]...
View 24 Replies
View Related
Mar 4, 2011
I've been searching the forums and google in an attempt to find an answer. I'm completely new to scripting and just want to get one or two up and running but I'm having problems with my current script. I want the script to:read my inputs run a loop in certain steps
within the loop execute a program with output to another file enter the values into the program (Problem area)
Quote:
#!/bin/bash
echo "Enter the Lower value, followed by [ENTER]"
read L
echo "Enter the number of steps you want to take, followed by [ENTER]:"
read s
[code]....
Running the program from the shell asks for 3 variables, which in my script are i, tt and adstep. I understand conceptually why it won't work. It won't move onto the next line in the loop until the previous task is completed (which doesn't even start without the 3 inputs!)
View 3 Replies
View Related
Aug 21, 2011
I hope this post stands in the right section.I have a commandline i need to enter in terminal when i want to run a program. i tought lets put that piece of command in an .sh file and just click the file to run the program (then i dont need to open terminal first an give in the command) however the .sh file does not open the program. so i propably need to make a executable (application/x-executable).
View 3 Replies
View Related
Jun 20, 2010
I am running into a snag on .exe files in Lucid. I have Wine installed, but I can not open the file as it is blocked from executing with a window popping up telling me that this file was blocked due to security reasons. I go into the files properties and try to change the permission but that does not help. Is there a way to get around this? Possibly in the terminal as root?
View 3 Replies
View Related
Jun 25, 2010
I have a startup script for jboss (start.sh) that sets some JAVA_OPTS and then calls bash run.sh.If I run it (start.sh) from the command line it runs in the terminal fine. If I make a shortcut launcher for it in gnome and set it for 'application in terminal' it pops up then immediately dies after launch.Not sure what the problem is. Is this not working because one script is calling a second script? But then why does it work when I call ./start.sh?
View 4 Replies
View Related
Jul 18, 2010
~$ sed s/^bb/bbbbbb/ foo1.txt
~$ sed: -e expression #1, char 3: unterminated s command
~$
Where 'b' stands for space. What is the error here? Sed is running under bash.
View 6 Replies
View Related