To create a subdirectory named "hw0" in your account directory and place the files with names starting with "hw0" in it, you can follow these steps:

  1. Open your terminal.
  2. Navigate to your account directory by running the following command:
    cd ~
    
  3. Create the "hw0" subdirectory with the following command:
    mkdir hw0
    
  4. Navigate to the "hw0" subdirectory:
    cd hw0
    
  5. Create a new file named "hw0_1.sh" and open it in a text editor. You can use any text editor of your choice. For example, to create and open the file with the nano text editor, run the following command:
    nano hw0_1.sh
    
  6. In the text editor, write the following Bash script:
    #!/bin/bash
    echo "Hello World"
    
    This script will display "Hello World" on your terminal window when executed.
  7. Save the file and exit the text editor. In nano, you can press Ctrl + X, then Y, and finally Enter to save and exit.
  8. Now, you can execute the script by running the following command:
    bash hw0_1.sh
    
    This will display "Hello World" on your terminal window.

You can repeat these steps to create and execute other files with names starting with "hw0" in the "hw0" subdirectory

在自己账户目录下创建子目录hw0所有要检查的文件都放在这个目录下文件名字以hw0开头如hw0_1sh等这时文件的路径应该是: ~hw0hw0_1sh ‘~表示你的账户所在更目录如pi账户那么完整路径就是homepihw0hw0_1sh。Writing Hello World Bash Script that can display Hello World on your terminal wind

原文地址: https://www.cveoy.top/t/topic/iWkA 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录