Unix for mac your visual blueprint to maximizing the foundation of mac osx phần 5

Bạn có thể sử dụng osascript công bố thư mục mới mỗi lần bạn sử dụng lệnh cd. Nó sử dụng các tcsh shell đặc biệt kịch bản cwdcmd, một lệnh thực hiện mỗi khi bạn thay đổi thư mục làm việc hiện tại. | 9 COMBINE UNIX AND AQUA r liliH j You can use osascript to announce the new directory each time you use the cd command. It uses the special tcsh shell script cwdcmd a command executed each time you change the current working directory. Create a directory for storing scripts such as Library OSAscript. HCreate a shell script in the directory named containing the following osascript -e tell current Application to say New Dir cwd HAdd an alias command to your .tcshrc file that sets the cwdcmd alias alias cwdcmd source Library OSAscript You can type source .tcshrc to run your .tcshrc file and add this alias or you can type the alias command in step 3 to set the alias for your current Terminal window. When you change to a new directory the cwdcmd alias executes. The source command reads in the shell script and runs it calling the osascript command. The value of the current working directory is stored in the shell variable cwd and the new directory is announced because the value is used in the Applescript say command. There is one hitch to using this script You will change directories slowly because the cd command will not end until the full path is spoken. RUN AN APPLESCRIPT FILE L n Create a text file containing your Applescript using a text editor. -H Type osascript and a space. L-Q Type the name of the script file and press Return. The osascript command executes the Applescript file. 131 UNIX FOR MAC CREATE CLICKABLE SHELL SCRIPTS You can make shell scripts that you can run by doubleclicking their icons in the Mac OS X Finder. A script is clickable if the name of the script file ends with the suffix .command. Ordinary shell scripts are not clickable. Double-clicking a shell script s icon opens it in a text editor instead of running it. To make it clickable you can make the script executable by using the chmod command and giving it a name ending in .command. When you double-click the icon of a .command file the Terminal program opens a new window

Bấm vào đây để xem trước nội dung
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
11    61    1    29-04-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.