Sudo

sudo:移動:找不到命令

  • March 4, 2019

我想在我的新 Linux Mint 19.1 上自動安裝 pycharm,在我使用 sudo move 命令之前一切正常。每當程式碼進入該行時,我都會收到“sudo: move: command not found”錯誤。我不知道怎麼了。我試著在這裡按照教程:

https://www.danieblog.com/technology/software/how-to-install-pycharm-community-in-linux-mint-72.html

我的程式碼如下:

#!/usr/bin/python3.6
import platform
import os
import time

pycharm_version = 'pycharm-community-2018.3.5'
filename = pycharm_version + '.tar.gz'
pycharm_link = 'https://download.jetbrains.com/python/' + filename

if platform.system().lower() == 'linux':
   command = 'wget {}'.format(pycharm_link)
   print(command)
   os.system(command)    
   command = 'tar xvaf {}'.format(filename)
   print(command)    
   time.sleep(1)
   os.system(command)
   time.sleep(1)
   command = 'sudo move /home/user/{} /opt/pycharm'.format(pycharm_version)
   print(command)
   os.system(command)

它應該是

sudo mv /home/user/{} /opt/pycharm

正如上面評論中提到的,這可以更簡單地在 shell 腳本中實現。

引用自:https://unix.stackexchange.com/questions/504370