mirror of
https://github.com/opensiriusfox/bashrc.d.git
synced 2025-06-16 20:31:15 -07:00
Merge branch 'master' into kusanagi
This commit is contained in:
commit
04823acf9e
1 changed files with 20 additions and 19 deletions
39
ps1.sh
39
ps1.sh
|
@ -18,27 +18,28 @@ function __currentDirTest() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function __smbGVFSReplace() {
|
## Sorry, KDE user now. gvfs doesn't exist.
|
||||||
local prefix_testing='/run/user/'$(id -u)'/gvfs/smb-share:server='
|
#function __smbGVFSReplace() {
|
||||||
local gvfs_pfx='/run/user/'$(id -u)'/gvfs'
|
# local prefix_testing='/run/user/'$(id -u)'/gvfs/smb-share:server='
|
||||||
if [[ $(__currentDirTest "$HOME") -eq 1 ]]; then
|
# local gvfs_pfx='/run/user/'$(id -u)'/gvfs'
|
||||||
echo $(__replacePathStr "$HOME" '\~')
|
# if [[ $(__currentDirTest "$HOME") -eq 1 ]]; then
|
||||||
elif [[ $(__currentDirTest $gvfs_pfx'/smb-share:server=') -eq 1 ]]; then
|
# echo $(__replacePathStr "$HOME" '\~')
|
||||||
local smb_match='smb-share:server=\([^,]*\),share=\([^/,]\+\)'
|
# elif [[ $(__currentDirTest $gvfs_pfx'/smb-share:server=') -eq 1 ]]; then
|
||||||
if [[ $(__currentDirTest $gvfs_pfx'/smb-share:server=' ',user=') -eq 1 ]]; then
|
# local smb_match='smb-share:server=\([^,]*\),share=\([^/,]\+\)'
|
||||||
echo $(__replacePathStr $gvfs_pfx'/'$smb_match',user=\([^,/]*\)\([^/]*\)' 'gvfs:\1=>\3@\2')
|
# if [[ $(__currentDirTest $gvfs_pfx'/smb-share:server=' ',user=') -eq 1 ]]; then
|
||||||
else
|
# echo $(__replacePathStr $gvfs_pfx'/'$smb_match',user=\([^,/]*\)\([^/]*\)' 'gvfs:\1=>\3@\2')
|
||||||
echo $(__replacePathStr $gvfs_pfx'/'$smb_match 'gvfs:\1=>\2')
|
# else
|
||||||
fi
|
# echo $(__replacePathStr $gvfs_pfx'/'$smb_match 'gvfs:\1=>\2')
|
||||||
else
|
# fi
|
||||||
echo $PWD
|
# else
|
||||||
fi
|
# echo $PWD
|
||||||
}
|
# fi
|
||||||
|
#}
|
||||||
|
|
||||||
function __replacePathStr() {
|
function __replacePathStr() {
|
||||||
__SEARCH=$(echo "$1" | sed 's_/_\\/_g')
|
__SEARCH=$(echo "$1" | sed 's_/_\\/_g')
|
||||||
__REPLACE=$(echo "$2" | sed 's_/_\\/_g')
|
__REPLACE=$(echo "$2" | sed 's_/_\\/_g')
|
||||||
echo $PWD | sed "s/${__SEARCH}/${__REPLACE}/g"
|
echo $PWD | sed "s/${__SEARCH}/${__REPLACE}/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,8 +71,8 @@ else
|
||||||
alt_hostname="\h"
|
alt_hostname="\h"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Flip this flag to disable samba path substition.
|
# Flip this flag to disable samba path substitution.
|
||||||
if [[ 1 -eq 0 ]]; then
|
if [[ 1 -eq 1 ]]; then
|
||||||
export PS1="\[\e[01;32m\]\u\[\e[00m\]@\[\e[01;32m\]${alt_hostname}"
|
export PS1="\[\e[01;32m\]\u\[\e[00m\]@\[\e[01;32m\]${alt_hostname}"
|
||||||
export PS1+="\[\e[01;34m\] \w \\$\[\e[00m\] "
|
export PS1+="\[\e[01;34m\] \w \\$\[\e[00m\] "
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue