Dear all,
currently in the command prompt, I need to execute a long list of commands
Code:
grid@node1:~/rac/troubleshoot_scan_name> ping -c 3 cluster-scan
grid@node1:~/rac/troubleshoot_scan_name> ping -c 3 node1-vip
grid@node1:~/rac/troubleshoot_scan_name> ping -c 3 node2-vip
..........
this is what I want to achieve,
write a bash script to execute the a list of command below, which can be done. However how do I include, echo or display the prompt, grid@node1:~/rac/troubleshoot_scan_name> naturally?
currently inside my bash script
Code:
export CURRENT_DIRECTORY="$(/bin/pwd)"
export REPLACEMENT="~"
export PROMPT_END="${CURRENT_DIRECTORY/${HOME}/${REPLACEMENT}}"
export PROMPT="${CURRENT_USER}@${HOSTNAME}:${PROMPT_END}> "
printf "\n${PROMPT}ping -c 3 cluster-scan\n"
ping -c 3 cluster-scan
While the above code achieve the above, it is quite error prone. What if whatever display does not reflect what actually happen?
for example
Code:
printf "\n${PROMPT}ping -c 3 cluster-scan\n"
ping -c 3 node1-vip
many thanks in advance!