Skip to content

Generate an echo command to recreate a text file

License

Notifications You must be signed in to change notification settings

Sad-theFaceless/file2echo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

file2echo

A simple bash script to get an echo command from a text file, in order to recreate it from the command.
Doesn't work on binary files.

Download

GNU/Linux

wget https://raw.githubusercontent.com/Sad-theFaceless/file2echo/main/file2echo.sh && chmod +x file2echo.sh

Windows

  • Right click on this link, and Save link as...
  • Once the file is downloaded, right click on it then Run with PowerShell

The first time you launch the PowerShell script, it will download all the prerequisite files in a temporary directory.
It will then open a new prompt window that allows you to run the actual Bash script. (see Usage)

Usage

Get the echo command

./file2echo.sh $FILE

Directly recreate a new file from the echo command

./file2echo.sh $FILE | bash > $NEW_FILE

Example

Taking a getIP.sh file with the following content:

#!/bin/sh

dig +short myip.opendns.com @resolver1.opendns.com A

Inside the terminal:

./file2echo.sh getIP.sh

Output:

echo -ne '#!/bin/sh\n\ndig +short myip.opendns.com @resolver1.opendns.com A\n'

About

Generate an echo command to recreate a text file

Topics

Resources

License

Stars

Watchers

Forks

Languages