RHEL hostname within the script

Hello,

I was trying to run a script which is based on RHEL, within the script i have to add hostname of the same machine where the action need to be execute. For an example

wait /bin/sh -c “mkdir -p /tmp/hostname of the machine

I am not sure how to bring hostname there which should be dynamic based on different machines?

Relevance substitution may be an easy way to do that. I don’t think $hostname variable would be accessible in the context that the action is running as.

wait /bin/sh -c "mkdir -p /tmp/{computer name}"

Does the client log show anything that may help? It successfully created the folder on my test machine

Thanks Working for me…Really appreciated…

1 Like