Git Product home page Git Product logo

bash-script-tutorial's Introduction

Session21

Challenge twenty description

  • Challenge 1: You are running a Bash script and it keeps giving you an error message, but you can't figure out what the problem is. Write a command that will run the script with debugging enabled, so you can see what is causing the error.

  • Challenge 2: You are trying to debug a Bash script, but there are too many lines of output and it's hard to find the problem. Write a command that will filter the output to show only lines that contain the word "error".

  • Challenge 3: You have a Bash script that runs fine on your machine, but it fails when you run it on a remote server. Write a command that will SSH into the server, run the script with debugging enabled, and save the output to a local file.

Hints to remember

  • Not using the -x flag to enable debugging. When debugging Bash scripts, it's important to enable the -x flag, which prints each command and its arguments as they're executed. This can help you identify issues and errors in your script

  • Using echo instead of printf for debugging output. When outputting debugging information to the console, it's important to use the printf command instead of echo. This is because echo may not properly handle special characters such as newlines, which can affect the readability of your debugging output. To avoid this, use printf instead, like this: printf "Debugging information: %s\n" "$var". You might have wondered why I used it, well ...:)

bash-script-tutorial

Bash scripts related to every session of this tutorial will be stored in isolated branches named after their session name.

How to use

You can access the main code and the challenge answer key related to every session at their own branch.

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.