Sponsored Content
Top Forums Shell Programming and Scripting Bash Script giving "Command Not found" Post 302859515 by infinitydon on Thursday 3rd of October 2013 10:50:59 AM
Old 10-03-2013
Bash Script giving "Command Not found"

Hello Geeks,

Greetings...I have the following script:

Code:
#!/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
		ggsn02
	  );
	  
##Attempted,Completed & Active PDP Skeleton Template

pdp_command(){
    for a in ${HOSTS[@]}; do
	"${a}pdp"=`sshpass -p "$password" ssh -q "$username"@"$a" "show services epg pgw statistics apn web.net" | grep "Active PDP contexts" | awk '{print $4}'`
    "${a}a1"=`sshpass -p "$password" ssh -q "$username"@"$a" "show services epg pgw statistics apn web.net" | grep "Attempted PDP activations" | awk '{print $4}' | sed '$s/,$//'`
    "${a}c1"=`sshpass -p "$password" ssh -q "$username"@"$a" "show services epg pgw statistics apn web.net" | grep "Attempted PDP activations" | awk '{print $6}'`
	 
	echo `date` "Active PDP Contexts for the past 15 mins is:" $a'pdp'>> /var/ipworks/logs/active_pdp/`date | awk '{ print $2"-" $3"-" $6 }'`"$a_active_pdp".txt
	
	echo $a'a1'
	echo
	echo $a'c1'
	done
}

pdp_command



But problem is when bash calls pdp_command function, i usually get command not found for the variable substitution.


Code:
root###bash -x pdp_stats.sh 
+ username=xxxx
+ password=xxxxxxxx
+ HOSTS=(ggsn01 ggsn02)
+ pdp_command
+ for a in '${HOSTS[@]}'
++ sshpass -p xxxssh -q xxx@ggsn01 'show services epg pgw statistics apn web.net'
++ grep 'Active PDP contexts'
++ awk '{print $4}'
+ ggsn01pdp=
pdp_stats.sh: line 18: ggsn01pdp=: command not found
++ sshpass -p xxxx ssh -q xxx@ggsn01 'show services epg pgw statistics apn web.net'
++ grep 'Attempted PDP activations'
++ awk '{print $4}'
++ sed '$s/,$//'
+ ggsn01a1=
pdp_stats.sh: line 19: ggsn01a1=: command not found



Any help will be appreciated!

Moderator's Comments:
Mod Comment Please use code tags for your data and code
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

In ksh shell command - Print "-ABC" is giving error

Hi Guys, while executing the following command : print "-ABC" is giving following error : ksh: print: bad option(s) I cannot use echo for some other reasons, so any other option ? (2 Replies)
Discussion started by: sagarjani
2 Replies

2. 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

3. 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

4. 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

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. 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

7. Shell Programming and Scripting

Bash script fails with "function: not found" error

Hello everyone, I am having problems figuring this out. This script below is supposed to create a list of file names with their "md5sum", in a file "lib-list.txt" When I run it "sh component-list.sh " I get this:component-list.sh: 4: component-list.sh: function: not found component-list.sh:... (4 Replies)
Discussion started by: joemb
4 Replies

8. UNIX for Dummies Questions & Answers

"Help with bash script" - "License Server and Patch Updates"

Hi All, I'm completely new to bash scripting and still learning my way through albeit vey slowly. I need to know where to insert my server names', my ip address numbers through out the script alas to no avail. I'm also searching on how to save .sh (bash shell) script properly.... (25 Replies)
Discussion started by: profileuser
25 Replies

9. 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

10. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
KRB5-SYNC-BACKEND(8)						     krb5-sync						      KRB5-SYNC-BACKEND(8)

NAME
krb5-sync-backend - Manipulate Kerberos password and status change queue SYNOPSIS
krb5-sync-backend -h krb5-sync-backend (disable|enable) user krb5-sync-backend (help|list) krb5-sync-backend [-s] process krb5-sync-backend password user ad < password krb5-sync-backend purge days DESCRIPTION
krb5-sync-backend provides an interface to the queue of pending password and account status changes written by either this utility or by the synchronization plugin after failures. It can queue account enables, disables, or password changes for Active Directory, list the queued actions, or process the queued actions with krb5-sync (telling it to take its action from a file). The queue directory will contain files with names in the format: <username>-<domain>-<action>-<timestamp>-<count> where <username> is the name of the affected account ("/" will be replaced with "." in the file name and the realm will be removed), <domain> is "ad", <action> is either "enable" (used for both enabling and disabling accounts) or "password", <timestamp> is a ISO 8601 timestamp in UTC, and <count> is a two-digit zero-padded number between 0 and 99 (so that we can handle multiple changes that arrive in the same second). Each file contains a queued change in the format described in krb5-sync(8). Supported arguments to krb5-sync-backend are: disable user Queue a disable action (in Active Directory, as that's the only system currently supported for enable and disable) for user. enable user Queue an enable action (in Active Directory, as that's the only system currently supported for enable and disable) for user. help List the supported commands. list List the current contents of the queue. process Process the queue. All queued actions will be sorted alphanumerically (which due to the timestamp means that all changes for a particular user of a particular type will be done in the order queued). krb5-sync will be called for each queued action, as long as it continues to succeed. If it fails for a queued action, all other actions sharing the same username, domain, and action will be skipped and queue processing will continue with the next action that differs in one of those three parameters. password user ad < password Queue a password change for user in Active Directory, setting their password to password. By default, password is read from standard input. It can also be passed as a command-line argument, but this is less secure since the password is then readable by anyone on the system who can see the command-line arguments of processes. The entire standard input is taken as the password, including any trailing newlines, so be careful how the password is provided. If using something like echo, use "echo -n" or the "c" flag, depending on your system. purge days Delete all queued actions last modified longer than days days ago. This can be used to clean up old failed change propagations in situations where accounts may be created or have password changes queued that are later removed and never created in other environments. OPTIONS
-h, --help Display this documentation (by running this script through "perldoc -t" and exit. All other options and commands are ignored. -s, --silent When running the process command, filter out the output of krb5-sync to ignore common errors and success messages and only show uncommon errors. This option will filter out all output when krb5-sync is successful and will filter out error messages matching: ^AD password change for S+ failed (3):.*Authentication error$ ^AD status change for S+ failed (1): user .* not found in S+$ even when it fails. (This message generally means the account doesn't exist in Active Directory.) The regexes can be modified at the start of this script. FILES
/usr/sbin/krb5-sync The path to the krb5-sync utility. This may be changed at the top of this script. /var/spool/krb5-sync The default path to the queue. This must match the queue_dir parameter in krb5.conf used by the plugin. It can be changed at the top of this script. /var/spool/krb5-sync/.lock An empty file used for locking the queue. When writing to or querying the queue, krb5-sync-backend will open and lock this file with the Perl flock function, which normally calls flock(2). Any other queue writers need to use the same locking mechanism for safe operation. SEE ALSO
krb5-sync(8) The current version of this program is available from its web page at http://www.eyrie.org/~eagle/software/krb5-sync/ <http://www.eyrie.org/~eagle/software/krb5-sync/>. AUTHOR
Russ Allbery <rra@stanford.edu> 2.2 2012-01-10 KRB5-SYNC-BACKEND(8)
All times are GMT -4. The time now is 07:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy