Skip to content
-
漠北新音 漠北新音

也不是重金属

  • 首页
  • 音乐与代码
    • 音乐?代码?
    • 编程与智力
    • 音乐与儿童
    • 当代码遇见音乐:数字时代的艺术二重奏
    • 数字琴弦上的交响
  • 源码下载

Posts by Toms G

Avatar photo
About Toms G
五 bash选项的保存修改和还原
Posted inlinux shell bash 基础

五 bash选项的保存修改和还原

【动机】

众所周知, bash 选项 errexit(默认为 off) 如果被设置为 on, 意味着只要主进程中任何一个函数(或命令)调用的退出码 (exitcode) 非0, 程序马上退出, 这对提高编码的健壮性的作用不言而喻.

Continue Reading
查看
Posted by Avatar photo Toms G 2025-03-12Tags: foundation
四 bash选项的获取和设置
Posted inlinux shell bash 基础

四 bash选项的获取和设置

【动机】

众所周知,bash 选项分两部分, 分别归 shopt 和 shopt -o 管理, 而后者等同于 set -o.

以 errexit 和 autocd 为例, 使用命令行返回的字符串获取:

Continue Reading
查看
Posted by Avatar photo Toms G 2025-03-11Tags: foundation
三  函数的命名参数设计
Posted inlinux shell bash 基础

三 函数的命名参数设计

【动机】

众所周知, linux shell 函数的定义, 默认采用位置参数, 在函数内部, 以 $1 $2 $3… 获取. 这对于一两个参数的函数, 还不觉得有何不便之处, 当参数个数多了以后, 不论是函数的编写还是调用或者扩展, 可能就不太好玩了.

Continue Reading
查看
Posted by Avatar photo Toms G 2025-03-11Tags: foundation
二 栈的简单实现
Posted inlinux shell bash 基础

二 栈的简单实现

【动机】

偶尔,我们为了某种需要,临时修改分隔符,例如:

Continue Reading
查看
Posted by Avatar photo Toms G 2025-03-10Tags: foundation
一 函数调用时, 局部变量的”穿透”
Posted inlinux shell bash 基础

一 函数调用时, 局部变量的”穿透”

本文讨论 linux shell 脚本函数中, 使用 local 定义的变量的 “穿透性”

Continue Reading
查看
Posted by Avatar photo Toms G 2025-03-10Tags: foundation

文章分页

Previous page 1 2 3

最新文章

  • 三 linux 远程服务器的常用操作封装
  • 二 使用 docker 运行 wordpress
  • 一 Linux Shell 字符模式下汉诺塔的UI实现
  • 十四 使用 shc 编译 linux shell 脚本为可执行文件
  • 十三 文件瘦身-去除 linux shell 脚本注释

分类

  • linux shell bash 基础
  • linux shell bash 工具
  • linux shell bash 应用

error image 滇ICP备2025067096号-1    滇公网安备53262102000539号

Copyright 2025 — 漠北新音.

All rights reserved. Thanks for your visiting!

Scroll to Top