sh Bash Utils

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Bash Utils相关的知识,希望对你有一定的参考价值。

# | Delete all and just keep the 3 recent backups
cd $FOLDER_BACKUP  && (ls -t | head -n 3;ls) | sort | uniq -u | sed -e 's,.*,"&",g' | xargs  rm
cd $FOLDER_COPY && (ls -t | head -n 3;ls) | sort | uniq -u | sed -e 's,.*,"&",g' | xargs  rm
# Format date
$(date +\%Y\%m\%d)
# | Create folders if dont exist

if [ ! -d "$FOLDER_BACKUP" ]; then
  mkdir -p $FOLDER_BACKUP
fi
#!/bin/bash

# | Script Path
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SCRIPT_PATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

# | Script Path Folder
SCRIPT_DIR=`basename $SCRIPT_PATH`

# | Path from excute
PWD="$(pwd)"

# | Path from excute
PWD_FOLDER=${PWD##*/}
if [ ! -f dist/.NO-DIST ]; then  touch "dist/.NO-DIST"; fi

以上是关于sh Bash Utils的主要内容,如果未能解决你的问题,请参考以下文章

sh BASH - HTTP和INTERNET UTILS

sh plcloud_utils.sh

sh commans utils

sh Git Utils

sh Docker Container Utils

sh Docker Utils脚本