简体   繁体   中英

After switching default shell, .command file just opens terminal

I have a myscript.command file like this:

#!/bin/bash


rm -rf ~/Downloads/*

that I added to the login items. However, when I login or manually execute it via double click, it just opens a terminal with my default fish shell without removing any file. If I set my default shell back to zsh, it works.

Why is that? What can I do?

What I've tried so far:

  • Change shebang to zsh, sh, fish
  • Make file executable for all users

Found the solution: Instead of switching the default shell like described in the official guide (lol) you can switch it by using

chsh -s /path/to/shell .

For some reason this makes.command files work again. Just make sure your desired shell is listed in /etc/shells

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM