PowerShell Core for Linux Administrators Cookbook
上QQ阅读APP看书,第一时间看更新

Writing the cmdlets (Linux admins note)

If you are a Linux administrator, chances are, you do not like long commands—verbosity, to be specific. We will try to make the commands as short as possible, but in the interest of readability (which is an important convention in PowerShell), we will also mention the full commands.

Tab completion comes in handy for reducing keystrokes. PowerShell tab-completes cmdlets, parameters, and in many cases, even parameter values. We will learn about this in the Running cmdlets with minimal keystrokes section of Chapter 2Preparing for Administration Using PowerShell.

In general, we split scripting from running cmdlets on the console in the following ways:

  • By using aliases (carefully) and short parameter names at the Terminal to save keystrokes and time
  • By being verbose in scripts, so that everyone using them can read and understand them