I am having problems working on a cross-platform platform with Windows 10 and Linux (Ubuntu) after SSHing in a remote Ubuntu terminal with an SSH Putty client .
What I'm basically trying to do:
In my personal GitHub account, I store and edit some code files (instead, save and edit them on my PC). Some of these files are Bourne ( .sh) shell files .
I want to copy the Bash code from inside the file that I have in my personal GitHub account, and then paste it into the Bash terminal for direct execution:
Copy the code from one of the files to GitHub (not the raw version).
Paste this code into the terminal.
Run this code by clicking Enterin the terminal.
The corresponding Bash code is the following code (originally taken from here ) that contains a Bash script 2 declaration of variable export and Bash with a cat here-document , indented with the top tabs of the tab, and also a function call
#!/bin/bash
export user="benqzq"
export repo="ulcwe"
preparations() {
cat <<-EOF >> "$HOME"/.bashrc
export s_a="/etc/nginx/sites-available"
export s_e="/etc/nginx/sites-enabled"
export drt="/var/www/html"
source "$HOME"/"$repo"/software_internal.sh
EOF
source "$HOME"/.bashrc 2>/dev/null
}
preparations
Current status and problem
The code is copied with Windows characters, such as the carriage return line separator ( CR), common on Windows, or leading spaces that may interfere with execution (it depends on the specific code that I copy, and in the case of the document here it really is in the sense that leading tabs of tabs turn into singleton or without tabs, etc., and this is forbidden when working with documents here).
Desired condition
, , GitHub Windows 10, CR.
, :
Linux ( Bash , Windows ( dos2unix sed "s/^[ \t]//g").
AHk TrimClipboard(), Windows.
JavaScript
, Linux (Bash), , AHk, , JavaScript- GitHub Windows, Windows ( , CR).
" " JavaScript? Greasemoneky script, script, github.com.
- Git, GitHub.
- , , heredocuments, .
- Windows , - //, CR. / CR-less.
- , , GitHub, , JavaScript. , GitHub Greasemonkey, , , .