Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

You probably want to write a bash script.

You start by adding a line that tells your system “Hey, this is a bash script”. This way, your system knows what interpreter to use. For bash, this is typically #!/bin/bash.

Typically, for a backup script, you want commands to run in a specific order and fail if a previous command fails. The way to do this is to use &&The way to do this is to use &&.

So command1 && command2 would run command2 only if command1 ran.

In other cases, you want to stream the output of a command into another command, in which case you use pipes.

If it’s an interactive application, you can pair this up with expect. Otherwise, it’s good practice to use variables.

Bash is a lot more powerful than this though — it’s got things like conditionals and loops you can abuse to make your life a lot easier. It’s also a handy ‘glue’ for tying together many simple text applications.

You probably want to write a bash script.

You start by adding a line that tells your system “Hey, this is a bash script”. This way, your system knows what interpreter to use. For bash, this is typically #!/bin/bash.

Typically, for a backup script, you want commands to run in a specific order and fail if a previous command fails. The way to do this is to use &&.

So command1 && command2 would run command2 only if command1 ran.

In other cases, you want to stream the output of a command into another command, in which case you use pipes.

If it’s an interactive application, you can pair this up with expect. Otherwise, it’s good practice to use variables.

Bash is a lot more powerful than this though — it’s got things like conditionals and loops you can abuse to make your life a lot easier. It’s also a handy ‘glue’ for tying together many simple text applications.

You probably want to write a bash script.

You start by adding a line that tells your system “Hey, this is a bash script”. This way, your system knows what interpreter to use. For bash, this is typically #!/bin/bash.

Typically, for a backup script, you want commands to run in a specific order and fail if a previous command fails. The way to do this is to use &&.

So command1 && command2 would run command2 only if command1 ran.

In other cases, you want to stream the output of a command into another command, in which case you use pipes.

If it’s an interactive application, you can pair this up with expect. Otherwise, it’s good practice to use variables.

Bash is a lot more powerful than this though — it’s got things like conditionals and loops you can abuse to make your life a lot easier. It’s also a handy ‘glue’ for tying together many simple text applications.

You probably want to write a bash script.

You start by adding a line that tells your system "Hey“Hey, this is a bash script"script”. This way, your system knows what interpreter to use. For bash, this is typically #!/bin/bash.

Typically, for a backup script, you want commands to run in a specific order and fail if a previous command fails. The way to do this is to use &&.

So command1 && command2command1 && command2 would only run command2command2 only if command 1command1 ran.

In other cases, you want to stream the output of a command,into into another command, in which case you use pipes.

If itsit’s an interactive application, you can pair this up with expect. Otherwise its, it’s good practice to use variables.

Bash is a lot more powerful than this though - its— it’s got things like conditionals and loops you can abuse to make your life a lot easier. ItsIt’s also a handy 'glue'‘glue’ for tieingtying together many simple text applications.

You probably want to write a bash script.

You start by adding a line that tells your system "Hey, this is a bash script". This way, your system knows what interpreter to use. For bash, this is typically #!/bin/bash

Typically for a backup script, you want commands to run in a specific order and fail if a previous command fails. The way to do this is to use &&

So command1 && command2 would only run command2 if command 1 ran.

In other cases you want to stream the output of a command,into another command, in which case you use pipes.

If its an interactive application, you can pair this up with expect. Otherwise its good practice to use variables.

Bash is a lot more powerful than this though - its got things like conditionals and loops you can abuse to make your life a lot easier. Its also a handy 'glue' for tieing together many simple text applications

You probably want to write a bash script.

You start by adding a line that tells your system “Hey, this is a bash script”. This way, your system knows what interpreter to use. For bash, this is typically #!/bin/bash.

Typically, for a backup script, you want commands to run in a specific order and fail if a previous command fails. The way to do this is to use &&.

So command1 && command2 would run command2 only if command1 ran.

In other cases, you want to stream the output of a command into another command, in which case you use pipes.

If it’s an interactive application, you can pair this up with expect. Otherwise, it’s good practice to use variables.

Bash is a lot more powerful than this though — it’s got things like conditionals and loops you can abuse to make your life a lot easier. It’s also a handy ‘glue’ for tying together many simple text applications.

added 1 character in body
Source Link
Journeyman Geek
  • 130.3k
  • 52
  • 272
  • 443

You probably want to write a bash script.

You start by adding a line that tells your system "Hey, this is a bash script". This way, your system knows what interpreter to use. For bash, this is typically #!/bin/bash

Typically for a backup script, you want commands to run in a specific order and fail if a previous command fails. The way to do this is to use &&

So command1 && command2 would only run command2 if command 1 ran.

In other cases you want to stream the output of a command,into another command, in which case you use pipes.

If its an interactive application, you can pair this up with expect. Otherwise its good practice to use variables.

Bash is a lot more powerful than this though - its got things like conditionals and loops you can abuse to make your life a lot easier. Its also a handy 'glue' for tieing together many simple text applications

You probably want to write a bash script.

You start by adding a line that tells your system "Hey, this is a bash script". This way, your system knows what interpreter to use. For bash, this is typically #/bin/bash

Typically for a backup script, you want commands to run in a specific order and fail if a previous command fails. The way to do this is to use &&

So command1 && command2 would only run command2 if command 1 ran.

In other cases you want to stream the output of a command,into another command, in which case you use pipes.

If its an interactive application, you can pair this up with expect. Otherwise its good practice to use variables.

Bash is a lot more powerful than this though - its got things like conditionals and loops you can abuse to make your life a lot easier. Its also a handy 'glue' for tieing together many simple text applications

You probably want to write a bash script.

You start by adding a line that tells your system "Hey, this is a bash script". This way, your system knows what interpreter to use. For bash, this is typically #!/bin/bash

Typically for a backup script, you want commands to run in a specific order and fail if a previous command fails. The way to do this is to use &&

So command1 && command2 would only run command2 if command 1 ran.

In other cases you want to stream the output of a command,into another command, in which case you use pipes.

If its an interactive application, you can pair this up with expect. Otherwise its good practice to use variables.

Bash is a lot more powerful than this though - its got things like conditionals and loops you can abuse to make your life a lot easier. Its also a handy 'glue' for tieing together many simple text applications

Source Link
Journeyman Geek
  • 130.3k
  • 52
  • 272
  • 443
Loading