Code Monkey home page Code Monkey logo

command-line-one-liner-challenges's Introduction

About

Blog post: Command-line One-liner Challenges

Watch this project, I'll add more challenges over time.

How it works

There are 4 files to know about:

  • input.txt -- The input file.
  • compare.sh -- What you need to run. Some implementation is missing.
  • actual.txt -- The output of the transformed input.txt. Created by running compare.sh.
  • expected.txt -- What input.txt needs to be transformed into.

Each directory contains two subdirectories: problem and solution. The only difference between problem and solution directories is the content of compare.sh file.

In the problem directory, you need to implement the convert function inside compare.sh. This is always the same, a passthrough function:

convert() {
  cat "$@"
}

You are aiming for a one-liner. It should be as functional as possible: no variables, temporary files, or side-effects.

Invoke compare.sh

./compare.sh

There is still work to do if you get:

Files actual.txt and expected.txt differ

If you are debugging, you can change the diff command to whatever suits you:

DIFF=vimdiff ./compare.sh

Or:

DIFF="diff -u" ./compare.sh

command-line-one-liner-challenges's People

Contributors

cdosborn avatar jpalardy avatar tpenguinltg avatar

Watchers

 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.