Think before you speak, read before you think.

我的shell脚本注释块 | 事半功倍

by

in

写bash脚本时,每次把下面脚本加进去

#!/bin/bash
#for use:
#author: jpuyy date  jpuyy.com@gmail.com
#modified by xx at date
#version:
#history:
#relate on:
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

这里最后一句使用export,使得执行后,各变量和操作结束,从而不会传回到父进程中。

也就是系统会分配bash来让我们执行这个脚本,这也是一般情况下我们想要的效果。

如果想让变量和操作在结束后留在系统里,要用source命令

常见的是

source ~/.bashrc

整理一下其他文件头部注释块:

python开头代码

#!/usr/bin/env python
#for use:
#author: jpuyy date  jpuyy.com stubusy@gmail.com
#modified by xx at date
#version:
#history:
#relate on:

:)EOT


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *