GithubHelp home page GithubHelp logo

bash's Introduction

Linux Shell编程

20200127_164206_47

Shell 是一个用 C 语言编写的程序,它是用户使用 Linux 的桥梁。Shell 既是一种命令语言,又是一种程序设计语言。

Shell 是指一种应用程序,这个应用程序提供了一个界面,用户通过这个界面访问操作系统内核的服务。

Ken Thompson 的 sh 是第一种 Unix Shell,Windows Explorer 是一个典型的图形界面 Shell。

本仓库内容

  1. shell脚本编程学习笔记
Something I hope you know before go into the coding~
First, please watch or star this repo, I'll be more happy if you follow me.
Bug report, questions and discussion are welcome, you can post an issue or pull a request.

相关站点

参考书目

  • 《Linux命令行与Shell脚本编程大全》
  • 《精通UNIX.shell脚本编程》
  • 《实战LINUX_SHELL编程与服务器管理》
  • 《Shell脚本编程诀窍——适用于Linux、Bash等》

目录

总结

  1. 基础永远值得花费90%的精力去学习加强。厚积而薄发~
  2. 实践的重要性

常用套路snip

if判断

  • [[ ... && ... && ... ]] 和 [ ... -a ... -a ...] 不一样,[[ ]] 是逻辑短路操作,而 [ ] 不会进行逻辑短路
  • [[ ... ]]进行算术扩展,而[ ... ]不做
if [ X"${var}" != "X1" ];then
    ...
fi

&& and 判断

if [ X"${var}" != "X1" -a X"${var2}" != "X2" ];then
    ...
fi
if [[ X"${var}" != "X1" and X"${var2}" != "X2" ]];then
    ...
fi
if [[ X"${var}" != "X1"  ]] and [[  X"${var2}" != "X2" ]];then
    ...
fi

|| or 判断

if [ X"${var}" != "X1" -o X"${var2}" != "X2" ];then
    ...
fi
if [[ X"${var}" != "X1" || X"${var2}" != "X2" ]];then
    ...
fi
if [[ X"${var}" != "X1"  ]] or [[  X"${var2}" != "X2" ]];then
    ...
fi

20210708_224801_51

循环

死循环写法

while [ 1 ];do
    ...
done

bash's People

Contributors

nicyou avatar yifengyou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.