回答編集履歴

1

コードをipythonに変更。優先度を追記

2023/06/18 11:30

投稿

xebme
xebme

スコア1083

test CHANGED
@@ -6,20 +6,22 @@
6
6
  [Built-in magic commands](https://ipython.readthedocs.io/en/stable/interactive/magics.html#)
7
7
 
8
8
  **mac**
9
- ```bash
9
+ ```ipython
10
10
  ! ls
11
11
  ```
12
12
  **windows**
13
- ```command
13
+ ```ipython
14
14
  ! dir
15
15
  ```
16
16
  `ls`に統一したければ`%alias`を使って環境ごとにシステムコマンドを指定します。
17
17
  **mac**
18
- ```bash
18
+ ```ipython
19
19
  %alias ls ls
20
20
  ```
21
21
  **windows**
22
- ```command
22
+ ```ipython
23
23
  %alias ls dir
24
24
  ```
25
25
  両方の環境に対応するコマンドがないときはスクリプトを記述するなどの工夫が必要になります。
26
+ (追記) すでに`ls`という変数が定義されていたらエイリアスは無視されます。
27
+