Hi Don,
Thanks for your response again its really appreacited, terminating the output ctl-d would be good, and in regards to invoking the singlemsisdn script
it would need to be as per the below
for example the following numbers were entered earlier
So essentially it requires the script name followed by each MSISDN with a space in between.
Thanks again.
Last edited by Scrutinizer; 06-02-2013 at 07:11 PM..
Reason: code tags
For the record, private e-mail answered the question about how many operands can be given to singlemsisdn in a single invocation: the response was 100.
The following script was tested using both bash and a recent (i.e., version newer than 1988) Korn shell, but specifies bash since that is the shell the OP requested. This script uses variable arrays, substring variable expansions, and pattern substitution variable expansions that are extensions to the standards but work the same in both bash and ksh.
For this forum, this script is huge, but the well over half of the script is comments. It is written assuming that this script is stored in a file named getUKmobile, but you can change the name to anything you want. (If you change the name, please replace the name in the 2nd line of this with whatever name you use.)
Hi Don, Finally got round to checking the above and got stuck on the script this then intiates. The output for the above for example would be
singlemsisdn 447825812345 447825823344
The singlemsisdn script i have is below
As you can see this example is a lookup for 1 example msisdn but setting the argument that was entered within the script intial string.
In the script you have written for me it passes a variable number of arguments depending on how many the user entered. How would you recommend to paste this into the script where it shows
send "$msisdn0" I cant seem to get it to work.
Also I have noticed on your original script the user is unable to paste a list of MSISDN's in as it asks for them individually and if you attempt to paste a list you get the below
Is there anyway of being able to paste a list in ?
Thanks for your help.
Last edited by mutley2202; 07-22-2013 at 06:10 PM..
Reason: adding
I assume that you remember that you told me in PM that singlemsisdn could take up to 100 operands. I limited getUKmobile so it would never invoke singlemsisdn with more than 100 operands. Now you say it only takes one???
You could rewrite getUKmobile to invoke singlemsisdn every time an msisdn is verified (instead of saving them up and calling singlemsisdn once at the end) or you can modify singlemsisdn to accept multiple operands. I haven't written any expect scripts for a couple of decades and I can't entirely determine the menu system of the command with which your expect script is interacting, but the following should provide something close that you can modify to make work for you:
The code in red is added code; the code in yellow is removed code. Code indentation changes are not color coded, but are obvious. I have no idea if the modified timeout value will be appropriate for your needs, but I tried 10 times the number of operands as a starting point for you to adjust.
I wrote the getUKmobile bash script to your specifications. If you want to change the specifications, why don't you write up the new requirements and try modifyting the script to add this new feature? As a hint I would suggest modifying the following code:
to read an array or an explicit maximum number of variables and add a loop to process each array element or (non-empty) variable. You'll need to set IFS to the separator your users will use between entries pasted together on input lines. (Don't forget to update the prompt to indicate how to enter multiple 44 format MSISDN entries.) Please try to make the modifications on your own and let us know if you run into problems.
Hello Guys,
I would like to ask you for a favor. Could you please help me how can I assign any number as the parameter to a, from stdin (-c), in the following command line by using the 'switch' in a script?
awk '$8>a {print "File name:" $5,$8}'
I would also appreciate if you can share any... (1 Reply)
Hello everybody,
I use `case' quite a lot but , excellent as it is , it only gives one
final result ; can anyone suggest a way whereas , say long
lists of choices are given and I , or a user could select either one
two or any number of results to be echoed .
many thanks in... (3 Replies)
I have the following proc.
proc get_add {arg1 arg2 arg3 arg4 arg 5 .. ... arg N }
{
}
i need to count the number of arguments and also i need those arguments stored in an array.
please help out
---------- Post updated at 06:33 PM ---------- Previous update was at 05:30 PM ----------
... (1 Reply)
Good Evening all,
After spending the last week or so reading many posts I decided to register and join in. This is my first post on the forum so please forgive me as im new to this, Im after some help in throwing together a quick basic script without using expect to change the password on several... (4 Replies)
Hi All,
My file has the records as below:
aaa\bbb\c\dd\ee\ff\gg
zz\vv\ww
pp\oo\ii\uu
How can I get the value after the last delimeter.
My o/p:
gg
ww
uu
Thanks in Advance, (5 Replies)
Hi Folks,
I am trying to make a script to assign all diskspace to slice 0, on multiple sized disks. Since the disks are new they may need to be labelled also to avoid the error: Cannot get disk geometry
Below is my code struggling with logic which doesn't seem to be producing the desired... (0 Replies)
Hello, I was wondering if it were possible to call arguments passed to a script using a variable.
For example:
sh script.sh yes no good bad
x=$#
while
do
echo (last argument, then second last etc until first argument)
let x=($x-1)
done
should print out
bad
good
no (4 Replies)
I've created an awk script that handles a varying number of search strings handed to it as command line parameters ($1 $2 etc). There may be 1, or 2 or 3 or more. A simplified version of the script is:
awk -v TYP="$1 $2 $3 $4 $5 $6" '
BEGIN {
CTYP = split (TYP,TYPP," ")
}
... (2 Replies)
Hi All.
I need help for the below logic.
I ve a file like following
input file:
NopTX(5) // should be remain same as input
----Nop(@100); //1
Nop(90); //2
--Nop(80); //3
@Nop(70); //4
--@Nop(60); //5
@Nop@(@50); //6
--Nop@( 40); ... (3 Replies)
Hello
i have script that show me stuff , i need to excute this script every N seconds , is there any way to do it with one liner ? ( mybe perl )
thanks (7 Replies)