LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   randomize character substitution (https://www.linuxquestions.org/questions/programming-9/randomize-character-substitution-870445/)

vanid 03-23-2011 07:13 AM

randomize character substitution
 
Hi,

If any one help in my issue:
I done with executing few commands through telnet session automatically..and my code is executing command one by one without user intervention and shows the execution result.

now here what i need is to randomize the commands i.e if i type interactively wrong command then it shows particular error message(execution result here what i above mean it for). but when making automated the script now i want this to be automated i.e i want randomizing the commands execution automated.
SOMETHING OUTPUT LIKE:
$config/all...actual cmd
$config/all....not valid
Config?all....not valid
CONFIG?ALL..not valid
$config\all..not valid

I could really appreciate if any one can help on this...and many thanks in advance

Snark1994 03-24-2011 11:34 AM

What exactly do you mean by 'randomising'? What you're doing doesn't seem to be particularly random... Could you break down what you want your program to do? Also, what you're trying to do sounds rather strange. Perhaps a better question would be WHY do you want to do this? What are you trying to achieve? Because it sounds like there may be better ways of doing it, whatever it is...

vanid 03-24-2011 11:18 PM

I am sorry if my question is little confusing, actually i am new to this scripting language.

As simple as I want to say is: I want any command to be tested with all test cases....so that i can verify the command for all valid and invalid cases likewise we have emailid validation test.

Snark1994 03-27-2011 03:37 PM

I'm afraid I'm still finding it difficult to work what exactly you mean by "test cases"... Are you trying to see what happens if a user types a command incorrectly?

vanid 03-27-2011 11:13 PM

yes exactly that i need it. I want to to see what happens if a user types a command incorrectly? using expect script

Snark1994 03-29-2011 11:38 AM

Okay, that kinda makes sense :) now, why do you want to write a script for that? If there are no commands with the mis-spelled name, it will say
Code:

bash: foo: command not found
or something similar. If it happens to be the name of another command, it will run that command...


All times are GMT -5. The time now is 02:36 AM.