CodelyTV / dotly

🌚 Modular and easy to customize dotfiles framework
https://codely.com/cursos
MIT License
1.19k stars 116 forks source link

Using sed in 'script/dotfiles/create' does not work on linux #16

Closed Inmovilizame closed 3 years ago

Inmovilizame commented 4 years ago

Due to different behaviours in sed for MacOS (BSD) and Linux (GNU) there is no way to make an in-place substitution that works on both OS families.

# MacOS 
sed -i '' -e ... 

# Linux
sed -i -e ...

The only way I've found to make it work on both specifications was to use this workaround:

# Create in both OS families a '.bak' file that can be deleted
sed -i.'bak' -e ...

# Create in both OS families a '.' file that can be deleted
sed -i.'' -e ...

I had to face this issue while making some common Makefile used on linux and macos.

PD: Is it ok to contribute? Might be an option to use the os detection that already being used in dotly to apply a proper sed in each case... I know is dirty, but the only solution available so far if using sed is mandatory :)

PD2: Super happy with my CodelyTV susbcription and working on my dotfiles!!

Inmovilizame commented 4 years ago

Ok!

Maybe another workaround could be made in the installing process of dotly, by installing gnu-sed (and maybe bash too).

# brew install bash
brew install gnu-sed 

PD: I got it from the bash course :P

EduardoSimon commented 3 years ago

I tried your workaround in Ubuntu whitout any luck. Im getting the following error:

`🤔 Where do you want your dotfiles to be located? (default ~/.dotfiles2):

The path '/home/edu-ec/.dotfiles2' already exist Creating a backup in '/home/edu-ec/.dotfiles2.1604402061.back' Initializing your dotfiles git repository Cloning dotly Installing dotly dependencies Creating dotfiles structure sed: no se puede leer : No existe el archivo o el directorio `

In English: Cannot read: The file or directory does not exist

Any idea?

rgomezcasas commented 3 years ago

This should be fixed with #26 😊

Thanks for reporting!!