Jan-27-2020, 08:36 PM
Sure, below are the details/algorithm. Please review and advise if I have make any changes to the code.
1. File /root/pydev/serv has server1, server2, server3
cat /root/pydev/serv
server1
server2
server3
2. Expected script function and output
- read the file /root/pydev/serv for its content.
- check the condition, which is "if the serv == server2"
- if the condition matches or equals the contents/line/server from the file then print only that server exclusively. (Example: serv ==server2 then print only "server2" as output.
- if the condition does not matches or equals (example: if condition serv == server5) then only print "No Serv found" in the output.
1. File /root/pydev/serv has server1, server2, server3
cat /root/pydev/serv
server1
server2
server3
2. Expected script function and output
- read the file /root/pydev/serv for its content.
- check the condition, which is "if the serv == server2"
- if the condition matches or equals the contents/line/server from the file then print only that server exclusively. (Example: serv ==server2 then print only "server2" as output.
- if the condition does not matches or equals (example: if condition serv == server5) then only print "No Serv found" in the output.