01.windows 环境设置

windows下可以安装Git工具,

使用git bash操作

Windows 10 环境下,通过~/.bash_profile 设置 git bash 别名:

打开 git bash,需切换到当前用户主目录(若存在.bash_profile 文件,则不需要执行 touch 命令):

$ cd ~
$ touch .bash_profile 
$ vim .bash_profile 

打开后,在~/.bash_profile 文件中,输入如下格式代码设置 git 命令别名:

alias gs='git status'
alias ad='git add'
alias cm='git commit -m'
alias pl='git pull'
alias ps='git push'
alias br='git branch'
alias ck='git checkout'
alias mg='git merge'
alias df='git diff'
alias log='git log'
alias ll='ls -l'

别名设置好保存后,回到 git bash 需要执行以下代码,使其生效:

$ source ~/.bash_profile 

windows上git bash中chmod +x不起作用

在 windows 上的 git bash 中执行下面的 chmod 命令

$ chmod +x test.sh

执行后对应的文件依然是不可执行的

-rw-r--r-- 1 admin 197121   0 5月  16 11:57 test.sh在 windows 上的 git 

bash 中执行下面的 chmod 命令

$ chmod +x test.sh

执行后对应的文件依然是不可执行的

-rw-r--r-- 1 admin 197121   0 5月  16 11:57 test.sh

问题原因

shell脚本前面没有加上#!/bin/bash

posted @ 2022-10-02 10:19  HaimaBlog  阅读(202)  评论(0编辑  收藏  举报