LoginSignup
8
6

More than 5 years have passed since last update.

pushd: not foundというエラー

Posted at

一定時刻にサーバ側でいろいろなスクリプトを実行させたいので、
スクリプトをまとめたリポジトリを作って、
cronで一定時間ごとにpullして実行するスクリプトを作ってました。

コードはこんな感じです

#!/bin/bash

if [ $# -ne 1 ]; then
  echo "plese set folder" 1>&2
  exit 1
fi

dir=$1
main=${dir%/}
today=`date "+%d.txt"`

log=${main}/log/${today}"

pushd $(dirname $0)

git checkout .
git pull origin master

./scripta/start.sh $main $log
./scriptb/start.sh $main $log

popd

ところが実行したところ、
pushd: not found
というエラーが出て全く起動していませんでした。

原因は上のスクリプトの
#!/bin/bash
#!/bin/sh
と書いており、shにpushdはないため失敗していました。

とりあえずbash使っておけばOKですね…

8
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
6