Let's say I have a program food in /bin/ that creates the file dinner.txt like so:#!/bin/bashtouch dinner.txtI want to use my food program to create dinner.txt in my /home/ folder without calling cd /home/ first. In other words, I want to call food as if it were called from /home/. How would I do this?Edit: Assume I can't edit the actual food program.
How do I call an executable as if it were called from another folder?
bash
(cd ~ && /bin/food)This launches it in a subshell.