#!/bin/bash

# 定义目标目录
TARGET_DIR="images"

# 确保目标目录存在
mkdir -p "$TARGET_DIR"

# 循环遍历三个源目录
for dir in train test valid; do
    if [ -d "$dir" ]; then
        echo "正在处理目录: $dir ..."
        
        # 使用 find 查找所有 .jpg 或 .jpeg 文件(-iname 忽略大小写)
        find "$dir" -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | while read -r file; do
            # -s 创建软链接,-r 自动计算相对路径
            ln -sr "$file" "$TARGET_DIR/"
        done
    else
        echo "提示: 目录 $dir 不存在,跳过。"
    fi
done

echo "所有项目的相对路径软链接已创建完成!"

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Install plugins.

  • autosuggesions plugin

    git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions

  • zsh-syntax-highlighting plugin

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

  • zsh-fast-syntax-highlighting plugin

    git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting

  • zsh-autocomplete plugin

    git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git $ZSH_CUSTOM/plugins/zsh-autocomplete

Enable plugins by adding them to .zshrc.

  • Open .zshrc

    nvim ~/.zshrc

  • Find the line which says plugins=(git).
  • Replace that line with
    plugins=(git zsh-autosuggestions zsh-syntax-highlighting fast-syntax-highlighting zsh-autocomplete)

References