前書き
このリポジトリは、chmodコマンドを実行してファイルの権限を変更した場合の挙動を検証します
インストールする必要のあるコマンド
- git
クイックスタート
上記のコマンドをインストール済みの方は、以下のコマンドを実行してリポジトリからダウンロード後、ディレクトリを移動し、chmodを実行して権限が変更されたshell scriptを実行してみてください
ubuntu
git clone https://github.com/trygfmi/chmod_checkAuthority
cd chmod_checkAuthority
ls -l
cat ./start_chmod_checkAuthority.sh
chmod 755 ./start_chmod_checkAuthority.sh
./start_chmod_checkAuthority.sh #rwxr-xr-x 755
chmod -x ./start_chmod_checkAuthority.sh
./start_chmod_checkAuthority.sh #rw-r-xr-x 655
macos
※MacPortsを使用しています
git clone https://github.com/trygfmi/chmod_checkAuthority
cd chmod_checkAuthority
ls -l
cat ./start_chmod_checkAuthority.sh
chmod 755 ./start_chmod_checkAuthority.sh
./start_chmod_checkAuthority.sh #rwxr-xr-x 755
chmod -x ./start_chmod_checkAuthority.sh
./start_chmod_checkAuthority.sh #rw-r-xr-x 655
windows
※MSYS2 MINGW64を使用しています
git clone https://github.com/trygfmi/chmod_checkAuthority
cd chmod_checkAuthority
ls -l
cat ./start_chmod_checkAuthority.sh
chmod 755 ./start_chmod_checkAuthority.sh
./start_chmod_checkAuthority.sh #rwxr-xr-x 755
chmod -x ./start_chmod_checkAuthority.sh
./start_chmod_checkAuthority.sh #rw-r-xr-x 655
実行手順
ubuntu
クリックして詳細を開く
事前確認
以下のコマンドを端末に打ち込んでcommand not foundが出なければokです
git --version
preinstall
command not foundが出たコマンドを以下のコマンドでインストールしてください
sudo apt install git
コマンド
以下のshell scriptを実行することで詳細のような文字列が出力されるはずです
git clone https://github.com/trygfmi/chmod_checkAuthority
cd chmod_checkAuthority
ls -l
cat ./start_chmod_checkAuthority.sh
chmod 755 ./start_chmod_checkAuthority.sh
./start_chmod_checkAuthority.sh #rwxr-xr-x 755
chmod -x ./start_chmod_checkAuthority.sh
./start_chmod_checkAuthority.sh #rw-r-xr-x 655
詳細
hello chmod command world
bash: ./start_chmod_checkAuthority.sh: Permission denied
macos
クリックして詳細を開く
事前確認
以下のコマンドをターミナルに打ち込んでcommand not foundが出なければokです
source ~/bashrc_folder/macports_alias
git --version
※macosはMacPortsパッケージマネージャを使用してコマンドを管理します。もしインストールしていない方は以下のリンクからMacPortsのインストール手順をご覧ください
またコマンドに別名を設定して既存の環境と競合しないでコマンドを呼び出せるようにします。
初めてこのブログを利用する方は、以下の2つの記事を参考に環境構築してください
preinstall
command not foundが出たコマンドを以下のコマンドでインストールしてエイリアスを設定してください
sudo port install git
echo 'alias git="/opt/local/bin/git"' >> ~/bashrc_folder/macports_alias
コマンド
以下のshell scriptを実行することで詳細のような文字列が出力されるはずです
source ~/bashrc_folder/macports_alias
git clone https://github.com/trygfmi/chmod_checkAuthority
cd chmod_checkAuthority
ls -l
cat ./start_chmod_checkAuthority.sh
chmod 755 ./start_chmod_checkAuthority.sh
./start_chmod_checkAuthority.sh #rwxr-xr-x 755
chmod -x ./start_chmod_checkAuthority.sh
./start_chmod_checkAuthority.sh #rw-r-xr-x 655
詳細
hello chmod command world
bash: ./start_chmod_checkAuthority.sh: Permission denied
windows
クリックして詳細を開く
事前確認
以下のコマンドをMSYS2 MINGW64に打ち込んでcommand not foundが出なければokです
git --version
※windowsはMSYS2 MINGW64で確認しています。もしインストールしていない方は以下のリンクからmsys2のインストール手順をご覧ください
preinstall
command not foundが出たコマンドを以下のコマンドでインストールしてください
pacman --sync git
コマンド
以下のshell scriptを実行することで詳細のような文字列が出力されるはずです
git clone https://github.com/trygfmi/chmod_checkAuthority
cd chmod_checkAuthority
ls -l
cat ./start_chmod_checkAuthority.sh
chmod 755 ./start_chmod_checkAuthority.sh
./start_chmod_checkAuthority.sh #rwxr-xr-x 755
chmod -x ./start_chmod_checkAuthority.sh
./start_chmod_checkAuthority.sh #rw-r-xr-x 655
詳細
hello chmod command world
bash: ./start_chmod_checkAuthority.sh: Permission denied
後書き
chmod 754やchmod 751など色々試してみてください