Skip to main content
Post Closed as "Duplicate" by Jeff Schaller, HalosGhost, John1024, techraf, Gilles 'SO- stop being evil' command-line
deleted 18 characters in body; edited tags
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264

To modify a host's resolved address we can change /etc/hosts
I want to have that functionality when running a single script without actually modifying /etc/hosts
Something

$HOST=foo.bar:10.0.1.256 ping foo.bar

would be the same as having an entry in /etc/hosts 10.0.1.256 foo.bar
and $ ping foo.bar

Is this doable? Thanks in advance.

To modify a host's resolved address we can change /etc/hosts
I want to have that functionality when running a single script without actually modifying /etc/hosts
Something

$HOST=foo.bar:10.0.1.256 ping foo.bar

would be the same as having an entry in /etc/hosts 10.0.1.256 foo.bar
and $ ping foo.bar

Is this doable? Thanks in advance.

To modify a host's resolved address we can change /etc/hosts
I want to have that functionality when running a single script without actually modifying /etc/hosts
Something

$HOST=foo.bar:10.0.1.256 ping foo.bar

would be the same as having an entry in /etc/hosts 10.0.1.256 foo.bar
and $ ping foo.bar

Is this doable?

Source Link

host resolve setting for one command?

To modify a host's resolved address we can change /etc/hosts
I want to have that functionality when running a single script without actually modifying /etc/hosts
Something

$HOST=foo.bar:10.0.1.256 ping foo.bar

would be the same as having an entry in /etc/hosts 10.0.1.256 foo.bar
and $ ping foo.bar

Is this doable? Thanks in advance.