Skip to content
Snippets Groups Projects

Set apps for extensions

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Dmytro Bogatov
    Edited
    set-apps-for-extensions.sh 496 B
    #!/usr/bin/env bash
    
    # run with 
    # curl -s https://git.dbogatov.org/-/snippets/51/raw/master/set-apps-for-extensions.sh | bash
    
    set -e
    
    echo "Setting extensions"
    
    set -x
    
    for extension in "md" "txt" "tex" "aux" "bib" "ris" "log" "sh" "c" "cpp" "h" "hpp" "py" "yaml" "yml" "json" "sql"
    do
        duti -s $(osascript -e 'id of app "Visual Studio Code"') .$extension all
    done
    
    duti -s $(osascript -e 'id of app "Skim"') ".pdf" all
    
    duti -s $(osascript -e 'id of app "Safari"') ".svg" all
    
    echo "Done."
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment