run terminal command

Just starting out? Need help? Post your questions and find answers here.
Posts: 1272
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

run terminal command

Post by collectordave »

This always bugs me.

I start the terminal and run this
exiftool -UserComment /Users/dave/Documents/Testexif/482.jpg > /Users/dave/Documents/TestExif.txt"
works perfectly every time.

How can I use Runprogram to run that in the terminal and the close the terminal?
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Posts: 203
Joined: Sun May 14, 2017 1:48 am

Re: run terminal command

Post by AZJIO »

I didn't check it

Code: Select all

PathS$ = "/Users/dave/Documents/Testexif/482.jpg"
PathD$ = "/Users/dave/Documents/TestExif.txt"
RunProgram("bash", ~"-c \"exiftool -UserComment '" + PathS$ + "' > '" + PathD$ + ~"'\"", "", #PB_Program_Open | #PB_Program_Read)
I use the following string:

Code: Select all

tmp = RunProgram("bash", ~"-c \"find '" + sPath + "' -type f " + printf$ + ~"' 2>&1\"", "", #PB_Program_Open | #PB_Program_Read)
the command is in double quotes, the paths are in single quotes.
Post Reply