Windows Powershell
1.创建并修改Windows Powershell 启动执行文件
echo $PROFILE
编辑C:\Users\hongyang.jia\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
2.按照以下格式输入命令
function 别名 { 需要替代的命令 }
例如我的Git简写命令
function gs {git status}
function中多行脚本执行报:因为在此系统上禁止运行脚本。有关详细信息,问题解决:
管理员运行powershell,执行:
set-executionpolicy remotesigned
示例
function sremote {wsl -d Ubuntu-20.04 sh -c "echo password| sudo -S; sshpass -p password ssh hongyang.jia@IP"}
function slocal {wsl -d Ubuntu-20.04 sh -c "echo 123456 | sudo -S; sshpass -p 123456 ssh root@IP "}
function scopy($file,$to) {
Write-Output $args[1]
$front="echo 123456 | sudo -S; sshpass -p password scp -r hongyang.jia@IP:/home/hongyang.jia/"
$front="$front$file $to"
Write-Host $file
wsl -d Ubuntu-20.04 sh -c $($front)
}
function sinstall() {
cd D:\Out\libxrengine_gtest
scopy code/framework/out/target/product/monaco_go/symbols/system/lib/libxrengine.so .
adb root ; adb remount
adb push libxrengine.so /system/lib/
adb reboot
adb wait-for-device
adb root ; adb remount
adb wait-for-device
adb shell "setenforce 0; stop; sleep 1s; start"
adb wait-for-device
}
function smake($mod) {
$cmd="sshpass -p password ssh hongyang.jia@IP cd /home/hongyang.jia/code/framework \&\&source build/envsetup.sh \&\& lunch 30 \&\& make $mod -j64"
wsl -d Ubuntu-20.04 sh -c $($cmd)
}
function sinstallmod($mod) {
cd D:\Out\libxrengine_gtest
scopy code/framework/out/target/product/monaco_go/symbols/system/lib/lib$mod.so .
adb root ; adb remount
adb push lib$mod.so /system/lib/
}
function srun() {
$start = Get-Date
wsl sh -c "sshpass -p password ssh hongyang.jia@IP cd /home/hongyang.jia/code/framework \&\&source build/envsetup.sh \&\& lunch 30 \&\& make xr_renderengine -j64"
sinstall
$end = Get-Date
Write-Host -ForegroundColor Red ('Total Runtime: ' + ($end - $start).TotalSeconds)
}
function scrcpy { #传递任意参数
& D:\software\scrcpy-win64-v2.1\scrcpy.exe $args
}
function scopyso{
cd D:\Out\libxrengine_gtest
scopy code/framework/out/target/product/monaco_go/symbols/system/lib/libxrengine.so .
}
function sdebug{
D:\Pro\adbDebug\debug.bat
adb logcat -v threadtime | D:\Android\Sdk\ndk\21.4.7075529\prebuilt\windows-x86_64\bin\ndk-stack -sym D:\Out\libxrengine_gtest
}
function shelp() {
" 1.sremote"
" 2.slocal"
" 3.srun :重新编译xrengine,安装调试"
" 4.scopy [source] [target] :copy from IP:/home/hongyang.jia/"
" 5.scopyso :copy so动态库"
" 6.sdebug :抓取crash"
}
function splay{
shelp
$choice = Read-Host "请选择:"
if([string]::IsNullOrWhiteSpace($choice)) {
return
}
}
function sshow{
" #开启引擎
adb root
adb shell setprop persist.xrrender.supported 1
adb shell reboot
#开启3dof
adb root
adb shell 'setenforce 0; stop; sleep 1s; start'
exit"
}
Ubuntu shell
vi ~/Desktop/init/note.sh
添加如下:
function scopy()
{
local fileName
if [ "$1" ] ; then
fileName=$1
fi
sshpass -p password scp -r hongyang.jia@ip:$fileName .
}
function smount()
{
mount -t cifs -o username="hongyang.jia",password="password" //ip/hongyang.jia /mnt/star
}
function sremote()
{
sshpass -p password ssh hongyang.jia@ip;clear
}
function sandroid()
{
export PATH=$PATH:/root/Android/Sdk/cmake/3.22.1/bin
export ANDROID_NDK=/root/Android/Sdk/ndk/21.4.7075529
export ANDROID_SDK=/root/Android/Sdk
export PATH=$PATH:$ANDROID_NDK:/root/Android/Sdk/platform-tools/
export ANDROID_HOME=$ANDROID_SDK
}
function spush()
{
local fileN
if [ "$1" ] ; then
fileN=$1
fi
sandroid
adb shell "mkdir -p /sdcard/AiCoding/"
adb push $fileN /sdcard/AiCoding/
}
echo be ready
vi ~/.bashrc
最后面添加一行
source ~/Desktop/init/note.sh
然后
source ~/.bashrc