Giter Club home page Giter Club logo

shellscripts's Introduction

Shell脚本注释


目录

  1. shell特性
  2. shell变量
  3. shell条件测试
  4. shell数据运算
  5. shell流程控制(if\case)
  6. shell循环控制(for\while\until break\continue\exit\shift)
  7. shell数组(arry)
  8. shell函数(function)
  9. 企业面试题目

1.shell特性

1.1 login shell与nologin shell

# 切换到username用户,并且使用该用户的bash环境配置
su -username
# 切换到username用户,但是使用原用户的bash环境配置
su username

运行shell的三种方式:

  1. 系统用户登录后默认运行的shell
  2. 非登录交互式运行shell
  3. 执行脚本运行非交互式shell
  1. 当用户登录linux系统时候,Shell会作为登录的Shell启动,下面讨论这种方式的环境变量加载顺序。默认加载/etc/profile,执行/etc/profile.d下的脚本文件,加载~/.bash_profile,有~/.bashrc则加载无则跳过,找/etc/bashrc有则加载无则跳过。
  2. 非登录的shell,直接加载~/.bashrc,并且去加载/etc/bashrc。非登录shell中,设置环境变量在~/.bashrc中或者/etc/profile中,不在~/.bash_profile或者/etc/profile中。

1.2 重定向

1.3 命令排序

1.4 元字符

1.5 颜色输出文本


2.shell变量

3.shell条件测试

4.shell数据运算

5.shell流程控制

6.shell循环控制

7.shell数组

8.shell函数

9.企业面试题目

shellscripts's People

Contributors

ikaixu avatar

Watchers

James Cloos 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.