How can I create a script with multi command I tried to create a script on OS X. I do something wrong.
I want to execute 2 command:

defaults write com.apple.finder CreateDesktop -bool true


and

killall Finder


I saved and chmod the file but I got some errors:

/Users/max/Desktop/visible.command ; exit;
MacBook-Pro-de-Maxime:~ max$ /Users/max/Desktop/visible.command ; exit;
/Users/max/Desktop/visible.command: line 1: {rtf1ansiansicpg1252cocoartf1343cocoasubrtf160: command not found
/Users/max/Desktop/visible.command: line 2: syntax error near unexpected token `}'
/Users/max/Desktop/visible.command: line 2: `{\fonttbl\f0\fnil\fcharset0 Menlo-Regular;\f1\fmodern\fcharset0 Courier;}'
logout




Thank you for your help!
You have saved your file as a Rich Text Format file (.rtf)

In TextEdit.app

Open your file and use the Make Plain Text menu to change it to the correct format for coding.

Using anything other than plan text will mean that the file includes formatting code  for styles and such that is visible to the shell layer but not to the user when viewing the file.

For example.

Rich Text Format file with the extension changed is still a rich text file





Reading it from the command line.

$ cat foo.command

{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720
{\fonttbl\f0\fnil\fcharset0 Menlo-Regular;}
{\colortbl;\red255\green255\blue255;\red43\green39\blue19;\red234\green234\blue234;\red37\green127\blue159;
}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\deftab720
\pard\pardeftab720

\f0\fs26 \cf2 \cb3 \expnd0\expndtw0\kerning0
defaults write com.apple.finder \cf4 \expnd0\expndtw0\kerning0
CreateDesktop\cf2 \expnd0\expndtw0\kerning0
 -bool true}




Change to plain text and re saved.









Read from the command line.

$ cat foo.command
defaults write com.apple.finder CreateDesktop -bool true


( examples are for illustration only and not how to do the actual coding)