Whiptail "Command not found"


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Whiptail "Command not found"
# 1  
Old 03-14-2016
Whiptail "Command not found"

Evening, I'd like to point out I am very much new to anything regarding scripting, so I apologize If I am / will ask stupid questions.

I am currently trying to design a script that will completely setup a server for a group that needs one, so that they can have a easy way of getting up and going, and I thought I was pretty close, till I change some names around, and suddenly everything broke.

I stole this code, which is where I first found whiptail, and wanted to make a cleanup command so that it will run certain tools to ensure the security of the server after the script was ran. (Wipe mem and free space on hd and so forth)

But when I created the "cleanup" and put it into the function folder, it didn't work. I changed the name of one to "server" and it did, but for some reason I can't get the script to point to the cleanup function.

The link to the actual script is here. Apologies for the mess it's in, I'll work on cleanup later. Smilie

(I guess i'll add links in the comments? Getting error saying I can't add to main post.

---------- Post updated at 05:56 AM ---------- Previous update was at 05:55 AM ----------

The original script that I copied from : github.com/snwh/ubuntu-post-install

My Script : github.com/keyxmakerx/Setup/blob/master/run.sh
# 2  
Old 03-15-2016
What does it mean to "point" a script to a function? We can't point scripts....

You get the error message "command not found", if the command (in this case whiptail) is neither an alias, nor a shell function, nor an *executable* program in your PATH (i.e. with the x-bit set).
# 3  
Old 03-15-2016
Again, I don't know the actual terminology I'm trying to use. But in the original script he has it to where functions point to other scripts, and it works w/o editing the path (feel free to take a look at what I ment in the original script)

But when I add something to the script, it does work. I am unsure how he was able to get that to work.
# 4  
Old 03-15-2016
Quote:
Originally Posted by KeyXMakerX
Again, I don't know the actual terminology I'm trying to use. But in the original script he has it to where functions point to other scripts, and it works w/o editing the path (feel free to take a look at what I ment in the original script)
I looked and the original script, and it differed from your version enough, that you should research the error from the other side. As I said, verify at the point, where you invoke the command, the aliases, the functions, and the PATH. For the safe side, also enable shell tracing at this point (using set -x).

Then we get some idea about the problem. My guess is that PATH is different at the point of the call of the command, between the original script and the modified script.
This User Gave Thanks to rovf For This Post:
# 5  
Old 03-15-2016
i've turned on set -x to test the script.

Though I'd like to point out that his script ran without editing any path variables, and I even changed the name of one to "server" and it worked. Yet, when I added one, it suddenly fell apart.

But as I said I'll try using this set -x thing to see where the issue lies. Thanks,

---------- Post updated at 07:58 AM ---------- Previous update was at 07:29 AM ----------

So I was able to find out that for some reason another function can't be in the same folder as the one serving the function. No idea cause it works now when i move it to a different folder.

So now I just need to figure out how to make a function launch a script which may seem simple for you smart peoples :P

Thanks for the help.
# 6  
Old 03-15-2016
Quote:
Originally Posted by KeyXMakerX
So I was able to find out that for some reason another function can't be in the same folder as the one serving the function.
To be honest, I don't understand this sentence. A "function" is never located in a folder, but always in a script. Also, I don't understand what it means to "serve" a function.

Since I can't even guess what's the problem, and you don't know enough yet about shell programming to formulate the problem, may I suggest that you post some (small!) example code, which illustrates your point.
# 7  
Old 03-15-2016
I don't quite understand it myself, like i said I know nothing about the terminology, I'm just going off of what I am seeing. but.

function thirdparty {
eval `resize`
THIRDPARTY=$(whiptail \
--notags \
--title "Third-Party Installation" \
--menu "\nWhat third-party software would you like to install?" \
--ok-button "Install" \
--cancel-button "Go Back" \
$LINES $COLUMNS $(( $LINES - 12 )) \
'birdie' 'Birdie Twitter client' \


the code above, will bring up a menu with the single option birdie. This was from the original script and would launch the function birdie. But. It wouldn't work for me and I didn't understand why, which seems to be because it was in the same directory as the one where this script resided as well. After moving into a sub folder "actions in this case" it worked.

So now what I want to hopefully accomplish is setting up a clean up script (since this is the most important part of the script as it is the scripts security) that will launch if I change the command to clean up. Which I could just mimick what he did with the birdie function.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Problem on SQLplus command ""bash: sqlplus: command not found""

Hi all, i face an error related to my server ""it's running server"" when i use sqlplus command $ sqlplus bash: sqlplus: command not found the data base is up and running i just need to access the sqlplus to import the dump file as a daily backup. i already check the directory... (4 Replies)
Discussion started by: clerck
4 Replies

2. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

3. Shell Programming and Scripting

Bash Script giving "Command Not found"

Hello Geeks, Greetings...I have the following script: #!/usr/bin/bash #Script to generate number of active PDP context & calculate PDP activation #failurefrom EPG-M #Script written by Gbenga Adigun #September 12, 2013 username="xxxxxx" password="xxxxxxxxx" HOSTS=( ggsn01... (6 Replies)
Discussion started by: infinitydon
6 Replies

4. Shell Programming and Scripting

"Command not found" doing a while loop in bash/shell

i=0 numberofproducts=${#urls} #gets number of entries in array called "urls" numberofproductsminusone=`expr $numberofproducts - 1` #-subtract by one while do wget ${urls} i=$(( $i + 1 )) sleep 10 done I'm getting an error ./scrape: line 22: [0: command not found that... (3 Replies)
Discussion started by: phpchick
3 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Post Here to Contact Site Administrators and Moderators

What's happens with my thread about "-bash: ELF: command not found "?

Hi, Today, I've submitted a new tread in "Shell Programming and Scripting" forum, with title "-bash: ELF: command not found ". However, this thread has disappear. Can somebody give me an explanation? Regards. (3 Replies)
Discussion started by: Sonia_
3 Replies

7. Shell Programming and Scripting

How to distinguish between "command not found" and "command with no result"

system() call imeplemented in solaris is such a way that: Command not found - return code 1 Command executed successfully without Output - return code 1 how to distinguish between these two based on return code in a c - file? Can you help on this ? (5 Replies)
Discussion started by: iitmadhu
5 Replies

8. Shell Programming and Scripting

"-bash: sqlldr: command not found"

hi all, here i am trying to run one control file. but getting "-bash: sqlldr: command not found" error :confused: the code is given below. sqlldr $db_username/$db_password@$db_sid control=$loading_path/load_to_table.ctl log=loading.log can anybody help me in fixing the issue? ... (1 Reply)
Discussion started by: vinayakatj56
1 Replies

9. UNIX for Dummies Questions & Answers

why emacs caused "command not found" error

I installed Red Hat Enterprise Linux 5 on my PC. When i typed 'emacs' on the console, "command not found" error occurrd. Why. :mad: (1 Reply)
Discussion started by: cy163
1 Replies
Login or Register to Ask a Question