DollarSkip is a short piece of C code designed to ignore the dollar symbol at the start of commands.

Related tags

CLI c
Overview

DollarSkip

https://img.shields.io/badge/Made%20in-C-%23808080

What is DollarSkip

DollarSkip is a short piece of C code designed to ignore the dollar symbol at the start of commands.

It aims to solve the annoyance of copying commands and having the annoying error

$: command not found

Installation

1-Liner install

You need to have wget installed to run this command

To install, run the following command in a terminal:

wget -qO- https://git.io/JsAqw | bash

The link is shortened version of https://raw.githubusercontent.com/CleanMachine1/DollarSkip/master/install.sh.

Manual install

To download and compile DollarSkip you need Git (to download the files) and Make (to make compilation easier)

To install DollarSkip without Git or Make

If you don't want to use Git and Make, you can download the zip from here and compile dollarskip.c with gcc dollarskip.c -o temp then move temp to /usr/bin/$ with sudo mv temp /usr/bin/\$.

To install, run the following commands in a terminal:

cd ~/ # Or your place of choice for Git repositories
git clone https://github.com/CleanMachine1/DollarSkip # Or use SSH
cd DollarSkip 
make # This makes the binary
sudo make install # This copies the binary to /usr/bin and names it '$'
make clean # Removes the binary created above since it has already been moved

After you can test to see if it works.

Open a terminal and run the command:

$ echo 1

If you get

1

it works!

If you get

$: command not found

please report an issue in the repo.

Uninstallation

cd ~/DollarSkip # Or where you put the Git directory
sudo make uninstall # Remove the binary in /usr/bin
cd .. 
rm -rf ./DollarSkip

# If the DollarSkip directory doesn't exist, simply run the following command:

sudo rm /usr/bin/\$

How this works

DollarSkip makes a binary file called $, in return whenever the first word of a command is $ on its own, Linux see this as a application, since when installing, the $ file is moved to /usr/bin

It can have side effects and if any occur, just run the uninstallation and tell me what went wrong!

Side Note

This project was a learning experience for me, since my C needs to improve!

I am not responsible for any damage to your system! Max character count in a single command is 8000! Anything over may create a segmentation fault!

In no event shall: The authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software. (MIT license)

If you decided to run a stupid command which creates a buffer overflow, expect a system crash!

Issues
  • Run the command using users default shell

    Run the command using users default shell

    I tested this, only problem I encountered is a segfault if the SHELL environment variable doesn't exist, if it exists but is empty, the program takes care of it: when the shell is detected succesfully:

    [email protected]:~/DollarSkip$ ./temp echo 123
    /bin/bash -c 'echo 123'
    123
    [email protected]:~/DollarSkip$
    

    else its run using the default for system (sh):

    [email protected]:~/DollarSkip$ ./temp echo 123
    echo 123
    123
    [email protected]:~/DollarSkip$
    

    for some reason the updated install script commit that you already merged is appearing here, I have no idea why.

    opened by Itai-Nelken 22
  • use 'execvp' instead of 'system' (fixes security vulnerabilities with 'system')

    use 'execvp' instead of 'system' (fixes security vulnerabilities with 'system')

    The system function has a security vulnerability that makes it possible to make it run malicious code (With aliases and custom functions I think). I changed to 'execvp()'. there is no need to detect user's shell as execvp() will search for the command in PATH (or if you supply a path, it will use it).

    The comments I wrote in the code explain it, but here is a small diagram of what happens:

    ____________________________________
    |                                  |  <-- child PID
    | DollarSKip parent (main) process | -- fork() --|
    -----------------------------------              |
                      |                              \/
                      |                   exact copy of parent process
                      |                       ---------------
                      |                      |               | <-- child_pid is 0 here because 
                      |                      | child process |     child has no child process
                      |                       ---------------
                      |                             |
                      |                             |
                   execvp()------------------------>|the child process gets replaced with the command
                      |                             | execvp inserts
              parent process waits                  |
           until the child has finished        child finished
                with waitpid()                 =============
                      |
                  parent ends
                  ==========
    

    hope this helps to understand what the code does.

    Signed-off-by: Itai Nelken [email protected]

    opened by Itai-Nelken 11
  • Better makefile

    Better makefile

    the targets now depend on the things they should: make and make-debug - dollarskip.c install and clean - make uninstall - install

    that means that now for example if you run sudo make install without running make first, make will automatically run the make target first.

    opened by Itai-Nelken 10
  • Could be a lot easier in a bash script lol

    Could be a lot easier in a bash script lol

    the script would contain

    [email protected]
    

    maybe make CleanMachine1/DollarSkipSh and put it in there lol (it also gets rid of the 8000 max char thing (which you probably also get rid of by using malloc instead))

    opened by PQCraft 8
  • Add comments to the code and move the declaration of the command variable into the main function

    Add comments to the code and move the declaration of the command variable into the main function

    I see no reason to for the command variable to be a global variable, so I moved it to the main function. I added comments explaining what the commands do, especially command[strlen(command)-1]='\0' as it was hard to understand exactly what its doing (at least for me).

    opened by Itai-Nelken 7
  • suggestion for the github actions workflow

    suggestion for the github actions workflow

    you don't need those 2 lines: https://github.com/CleanMachine1/DollarSkip/blob/42f5bb1c5ebcc2567f4532bb2c544d5db607a0d6/.github/workflows/main.yml#L28-L29 the checkout action does that already.

    opened by Itai-Nelken 7
  • Rewrite dollarskip.c

    Rewrite dollarskip.c

    Rewrote everything. It does the same thing but looks cleaner and is safer (it will fail if there isn't enough space in the command variable).

    Signed-off-by: Itai-Nelken [email protected]

    opened by Itai-Nelken 6
  • Rename `makefile` to `Makefile` and edit

    Rename `makefile` to `Makefile` and edit

    This Makefile both follows convention better, and uses sane defaults

    For example, make has default rules for building.

    All projects, unless they are certain, should use them.

    So this does.

    This also adds install without falling into the -D portability trap.

    opened by Vaelatern 6
  • makefile: adopted `PREFIX`

    makefile: adopted `PREFIX`

    There are many reasons to use this, like package managers, when building, don't want to install into the system.

    It is convention to not install directly into /usr/bin.

    opened by pixelcmtd 5
  • fix github actions

    fix github actions

    the gh actions runner is failing to run the binary, it exits with a segmentation fault for some reason. In my fork, I made the action upload the executable, I put it in /usr/bin and it worked perfectly fine even with box64:

    [email protected]:~/Downloads/artifact $ ls
    temp
    [email protected]:~/Downloads/artifact $ file temp
    temp: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=6c2d20add7e6550f86605bc08fe92689f4b3c867, for GNU/Linux 3.2.0, not stripped
    [email protected]:~/Downloads/artifact $ sudo mv temp /usr/bin/\$
    [email protected]:~/Downloads/artifact $ $ echo test 123
    Box64 with Dynarec v0.1.3 2976bf5 built on Jul 12 2021 13:53:42
    Using default BOX64_LD_LIBRARY_PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/
    Using default BOX64_PATH: ./:bin/
    Counted 28 Env var
    Looking for /usr/bin/$
    argv[1]="echo"
    argv[2]="test"
    argv[3]="123"
    Using native(wrapped) libc.so.6
    Using native(wrapped) ld-linux-x86-64.so.2
    Using native(wrapped) libpthread.so.0
    Using native(wrapped) librt.so.1
    test 123
    [email protected]:~/Downloads/artifact $ 
    

    but when running directly, it fails:

    [email protected]:~/Downloads/artifact $ ls
    temp
    [email protected]:~/Downloads/artifact $ ./temp $ echo 123
    Box64 with Dynarec v0.1.3 2976bf5 built on Jul 12 2021 13:53:42
    Using default BOX64_LD_LIBRARY_PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/
    Using default BOX64_PATH: ./:bin/
    Counted 28 Env var
    Looking for ./temp
    argv[1]="$"
    argv[2]="echo"
    argv[3]="123"
    Using native(wrapped) libc.so.6
    Using native(wrapped) ld-linux-x86-64.so.2
    Using native(wrapped) libpthread.so.0
    Using native(wrapped) librt.so.1
    /bin/bash: $: command not found
    [email protected]:~/Downloads/artifact $ 
    

    doing it natively does work:

    [email protected]:~/Documents/git/DollarSkip $ make
    gcc dollarskip.c -o temp
    [email protected]:~/Documents/git/DollarSkip $ ./temp $ echo 123
    123
    [email protected]:~/Documents/git/DollarSkip $ 
    

    I tried making the action run it by putting the executable in ~/.local/bin/$ and adding that to $PATH, but it still didn't work.

    The changes I made to the workflow

    • rename main.yml -> build.yml
    • remove the test part
    • make it upload the executable so we can test it later if we want
    opened by Itai-Nelken 5
  • Improve dependency installing in install.sh

    Improve dependency installing in install.sh

    I renamed the pkg-manager function to pkg-install, and now it installs all the packages names provided to it using the system package manager (apt or pacman for now). Then the if statments check if the packages aren't installed, if they aren't they are added to the array. then if the array isn't empty, the packages it contains are installed using the pkg-install function. I did this because I think that installing all the packages at once is better then checking if one is installed, if no install it. then check for the next packacge, if it's not installed, install it etc.

    opened by Itai-Nelken 5
  • Handle shell built-in commands

    Handle shell built-in commands

    This handles built-in shell commands. this is done by using 2 arrays:

    1. unhandled_shell_builtins: A string array containing the names of built-in commands that don't work through DollarSkip (cd for example).
    2. handled_shell_builtins: An array for Wrapper (struct wrapper) that holds commands we wrapped so they work through DollarSkip.

    To show how the handled shell built-ins work I added an "easter egg" command (e_egg). I thought about doing pwd, but I don't want to rewrite the bash version.

    Closes #46

    Signed-off-by: Itai-Nelken [email protected]

    opened by Itai-Nelken 3
  • Bug: cd doesn't do anything when used with DollarSkip

    Bug: cd doesn't do anything when used with DollarSkip

    opened by Crilum 2
  • makefile: fixed non-escaped dollar sign

    makefile: fixed non-escaped dollar sign

    have you ever tested make install or make uninstall? it just runs something like cp temp /tmp/foo/usr/bin/\ without the dollar sign at the end, because make likes to eat them for lunch.

    opened by pixelcmtd 10
  • Creating a ZSH mode

    Creating a ZSH mode

    ZSH uses %, simple change.

    Yet I have never seen a guide using ZSH instead of bash.

    Would be simple to implement with just making the file name /usr/bin/%

    enhancement 
    opened by CleanMachine1 6
  • Working with git

    Working with git

    Running commands such as

    $ git commit -m "test 123" --allow-empty
    error: pathspec '123' did not match any file(s) known to git
    

    Gives an error

    bug help wanted 
    opened by CleanMachine1 10
Releases(v3.1.3)
  • v3.1.3(Nov 21, 2021)

    What's Changed

    • Added PKGBUILD sums by @CleanMachine1 in https://github.com/CleanMachine1/DollarSkip/pull/33
    • Add comments by @Itai-Nelken in https://github.com/CleanMachine1/DollarSkip/pull/23
    • Add yay to README by @CleanMachine1 in https://github.com/CleanMachine1/DollarSkip/pull/39
    • README: grammatical error fix by @CleanMachine1 in https://github.com/CleanMachine1/DollarSkip/pull/40
    • Rename makefile to Makefile and edit by @Vaelatern in https://github.com/CleanMachine1/DollarSkip/pull/41

    New Contributors

    • @Vaelatern made their first contribution in https://github.com/CleanMachine1/DollarSkip/pull/41

    Full Changelog: https://github.com/CleanMachine1/DollarSkip/compare/3.1.2...v3.1.3

    Source code(tar.gz)
    Source code(zip)
  • 3.1.2(Aug 22, 2021)

  • 3.1(Aug 22, 2021)

  • 3.0(Aug 7, 2021)

    This is a continuation of version 2, and is made for the upcoming PKGBUILD for arch to be advertised here

    sha256sums=('8826bd814c543566130152e6e2da02b0d43363ca51f5e806e208760918a2531e')

    Source code(tar.gz)
    Source code(zip)
  • 2.0(Jun 27, 2021)

    Potentially unstable since it breaks the workflow.

    If I could get some testers, specifically ubuntu users, then I can make this a full release

    Source code(tar.gz)
    Source code(zip)
  • 1.0(Jun 6, 2021)

    This will not be used for anything in particular however it will be a stable version of the original DollarSkip. If falling back is required or your OS isn't supported in the version 2.0 to come.

    Source code(tar.gz)
    Source code(zip)
Owner
Linux Programmer. Bash, Python and C are my main languages.
null
An implementation of shell commands in C++

ShellSynergy An implementation of shell commands in C++ using std::filesystem Build To run the project execute command: [email protected]:~$ ./RUN.sh Short shel

Vova Makotkin 6 Dec 7, 2021
A utility for running arbitrary commands when files change

Event Notify Test Runner A utility for running arbitrary commands when files change. Uses kqueue(2) or inotify(7) to avoid polling. entr was written t

Eric Radman 1.9k May 14, 2022
CodeCompactor is an open source program designed for reducing the size of your code!

CodeCompacter An exciting, new and open source program for reducing the length of your code! Usage: ./CodeCompacter {ARGUMENTS} Arguments: -L {languag

Henry Dewsnap 1 Nov 28, 2021
Tool that generates unit test by C/C++ source code, trying to reach all branches and maximize code coverage

What is UTBotCpp? UTBotCpp generates test cases by code, trying to cover maximum statements and execution paths. We treat source code as source of tru

null 20 May 3, 2022
A single header C++ library for parsing command line arguments and options with minimal amount of code

Quick Arg Parser Tired of unwieldy tools like getopt or argp? Quick Arg Parser is a single header C++ library for parsing command line arguments

null 44 Feb 21, 2022
null 76 Apr 18, 2022
A simple command line application in order to create new Code workspaces.

mkcws Summary A simple command line application in order to create new Code workspaces. License This project's license is GPL 2. The whole license tex

Kevin Matthes 0 Apr 1, 2022
This contains code and relevant schematics from my Applied Digital Signal Processing class, where we developed various digital filters on the NXP FRDM K22F development board.

#dsp_class Summary This repo is meant to hold any of the C and MATLAB programming I did over the course of my Applied Digital Signal Processing class

Abdullah Almosalami 1 Nov 11, 2021
Spitfire is a basic terminal language that can exicute code via the terminal.

Spitfire is a basic terminal language that can exicute code via the terminal. It is easy to learn and runs fast, considering that its just a 300 line c++ file.

jhomas tefferson 0 Nov 18, 2021
A command-line tool to generate Linux manual pages from C source code.

mangen A command-line tool to generate Linux manual pages from C source code. Description mangen is, as said above, a program to generate Linux manual

null 2 Nov 15, 2021
Advent-of-Code: 2021 Edition

?? ?? Advent of Code 2021 ☃️ ❄️ Description Advent of code 2021 Awesome Advent of Code Advent of Code is an Advent calendar of small programming puzzl

Lento Manickathan 6 Apr 5, 2022
This is the massive repository for all code for the class CIS3250 Fall Semester.

========================================== Transforming Shapes Through Matrix Multiplication ========================================== Description o

null 4 Nov 25, 2021
This repository contains the source code of the project(StereoCraft) that we have developed for the Mixed Reality Hackathon organized by Microsoft using StereoKit SDK

StereoCraft - A block-building like experience built using StereoKit This repository contains the source code of the project that we have developed fo

G Bhanuteja 2 Dec 23, 2021
CppCompetitor - A program for dueling code bots.

CPP Competitor CPP Competetior is a mini program that's let you battle code bots. To get it running you only need A class for controlling the game's s

Nikola Dimitroff 1 Apr 23, 2020
nicegraf-shaderc is a command-line tool that transforms HLSL code into shaders for various graphics APIs.

User Manual Table of Contents Introduction Project Status Obtaining the Source Code and Building Running Defining Techniques Generated Header File Pip

nicebyte 87 May 2, 2022
Building a personal webserver/framework piece by piece

Building a personal webserver/framework piece by piece

E 1 May 11, 2022
Reverse engineered source code of the engineowning cheat for cod9 (tags, ignore. Fortnite cheat, engineowning, engineowning cracked, cheat cracked, cod cracked cheat, cod cheat source)

engineowning-cod9 Reverse engineered source code of the engineowning cheat for cod9 Cracked by CODEX notinjector = C:\Windows\Release\ .exe drSYS = C:

null 5 Apr 2, 2022
✔️The smallest header-only GUI library(4 KLOC) for all platforms

Welcome to GUI-lite The smallest header-only GUI library (4 KLOC) for all platforms. 中文 Lightweight ✂️ Small: 4,000+ lines of C++ code, zero dependenc

null 6.2k May 13, 2022
lcd1602, HD44780 chipset, battery symbol

LCD_HD44780_BATTERY_SYMBOL lcd1602, HD44780 chipset, battery symbol HD44780 LCM battery gauge and symbol design Read This http://wp.me/ph3BR-1ZJ The H

xiaolaba 1 Nov 21, 2021
A simple library to expose the linker namespace functionality in Android 9+ together with symbol hooking

Android Linker Namespace Bypass Library Provides access to the hidden linker namespace functionality in Android 9+ and exposes an interface for hookin

Billy Laws 6 May 8, 2022
🚀 Kick-start your C++! A template for modern C++ projects using CMake, CI, code coverage, clang-format, reproducible dependency management and much more.

ModernCppStarter Setting up a new C++ project usually requires a significant amount of preparation and boilerplate code, even more so for modern C++ p

Lars Melchior 2.7k May 10, 2022
This template provides a base structure to start developing a small raylib game in plain C

This template provides a base structure to start developing a small raylib game in plain C. The repo is also pre-configured with a default LICENSE (zlib/libpng) and a README.md (this one) to be properly filled by users.

Ray 90 May 16, 2022
Cold-start page provisioning speed test for WIndows

largepages This is a rudimentary test of cold-start memory paging on Windows that I put together for Raymond Chen's Tie, who was kind enough to ask it

Casey Muratori 29 Oct 19, 2021
A windows tool for changing the start button logo

WinLogo About This project is used to modify the start button logo of windows 10 computers. The logos are precompiled into the binary, but the UI supp

null 14 Apr 16, 2022
A remote start arduino sketch, written for a Volkswagen Golf Gti MK4. Icons provided by Icons8

Introduction ?? This is an arduino sketch that enables the use of a sim-reader in order to remotely start a vehicle Description This Arduino sketch is

Sivert 1 Feb 18, 2022
Just getting started with Data Structure and Algorithms? Make your first contribution here and start the journey of learning DSA.

Getting Started ! ✨ If you are just beginning with open source then let's make your first contribution in this repository ! Contributing Tutorial ?? P

amega 3 Apr 18, 2022
linalg.h is a single header, public domain, short vector math library for C++

linalg.h linalg.h is a single header, public domain, short vector math library for C++. It is inspired by the syntax of popular shading and compute la

Sterling Orsten 718 May 13, 2022
Cute Framework (CF for short) is the cutest framework available for making 2D games in C/C++

Cute Framework (CF for short) is the cutest framework available for making 2D games in C/C++. CF comprises of different features, where the various features avoid inter-dependencies. In this way using CF is about picking and choosing which pieces are needed for your game

null 208 May 10, 2022