Mac 'batchfile' script solution?

On Windows, I would create a .bat file to run this script from my desktop, on my Mac, how can I create something similar that can be run from the desktop to execute this:

 defaults write com.apple.finder AppleShowAllFiles TRUE
 killall Finder
+3
source share
4 answers

Create a file with the following contents

#!/bin/bash
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

From the .app terminal, run chmod o+x <filename>to make the executable.

To run the file, simply open terminal.app and ./<filename>

+4
source

Name the file .commandor .sh.

+4
source

Shoan script , Terminal. jtbandes .command (.sh ), Finder, , . , , - :

1- AppleScript AppleScript ( /Applications/Utilities/AppleScript Editor.app, /Applications/AppleScript/ Script Editor.app, , OS X ). script:

do shell script "defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder"

... script Application, ( "Script", , script).

2- Automator /Applications/Automator. ( , ), " Script" ( , "" ) . , , .

+2

, , . , , script.

, .

bash_profile.

bash - , , , .

, ?

, , , :

sudo nano ~/.bash_profile 

,

:

alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'

...

ctrl + O to save
ctrl + X to exit

bash:

source ~/.bash_profile

? , : showFiles , : hideFiles... voila!

, . , ssh - mysql .. ..

:

alias goWebsite='open http://www,google.com'
alias goDoc='open -a TextEdit /users/myusername/documents/mydocument.txt'
alias goLocation='cd /applications/mamp/htdocs/workspaces/general/website.com/trunk'
alias sshToServer='ssh user@mysite.sitename.com'

, , .

We hope you find it useful

0
source

Source: https://habr.com/ru/post/1758958/


All Articles