feat: first commit from pwsh7 in my Linux
This commit is contained in:
parent
0a6f271052
commit
4796df396a
0
bash/my_functions.sh
Normal file
0
bash/my_functions.sh
Normal file
5
bash/my_notes.md
Normal file
5
bash/my_notes.md
Normal file
@ -0,0 +1,5 @@
|
||||
## SSH
|
||||
|
||||
### Tunel reverso
|
||||
|
||||
- `ssh -R `
|
||||
20
pwsh7/My/Check_ProwerShell_profile.ps1
Normal file
20
pwsh7/My/Check_ProwerShell_profile.ps1
Normal file
@ -0,0 +1,20 @@
|
||||
# 1. Identificar el editor según el OS
|
||||
$editor = if ($IsLinux) { "vim" } else { "notepad" }
|
||||
|
||||
# 2. Verificar y crear el perfil si no existe
|
||||
if (!(Test-Path $PROFILE)) {
|
||||
Write-Host "Creando perfil en: $PROFILE" -ForegroundColor Yellow
|
||||
# Asegura que la carpeta contenedora exista (importante en Linux)
|
||||
New-Item -Type Directory -Path (Split-Path $PROFILE) -ErrorAction SilentlyContinue
|
||||
New-Item -Type File -Path $PROFILE -Force
|
||||
} else {
|
||||
Write-Host "El perfil ya existe en: $PROFILE" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# 3. Abrir el perfil con el editor correspondiente
|
||||
# Usamos Start-Process en Windows o invocación directa en Linux
|
||||
if ($IsLinux) {
|
||||
& $editor $PROFILE
|
||||
} else {
|
||||
Start-Process $editor $PROFILE
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user