J'ai créé un AppleScript qui redirige tous les fichiers déposés sur lui, vers un shell script avec le nom correspondant. Il suffit d'enregistrer l'application dans ScriptEditor d'Apple et de la renommer script.app pour qu'elle corresponde à votre script.sh.
on getScriptName()
tell application "Finder"
set p to path to me -- alias to the file of the running script
set fullName to name of file p as text
set strippedName to text 1 thru ((fullName's length) - (offset of "." in ¬
(the reverse of every character of fullName) as text)) of fullName -- strip off extension
end tell
set my_path to (((path to me as text) & "::") as alias) as string -- parent folder of running script
set ScriptName to POSIX path of my_path & strippedName & ".sh" -- path to bash script, expected to reside here
return ScriptName
end getScriptName
on run -- double click on application
set scriptfile to getScriptName()
tell application "Terminal"
activate
do script scriptfile
end tell
end run
on open dropfiles -- drag 'n drop files onto application
set posixfiles to " "
repeat with dropfile in dropfiles
set posixfiles to posixfiles & " " & POSIX path of dropfile
end repeat
set scriptfile to getScriptName()
tell application "Terminal"
activate
do script scriptfile & " " & posixfiles
end tell
end open
Il est basé sur cette réponse Je me suis seulement débarrassé de script.sh nom de fichier.