0
点赞
收藏
分享

微信扫一扫

Linux 当前工作路径名过长

大雁f 2022-03-23 阅读 71

前言

在编译uboot 下载安装 arm-linux-gcc版本时,发现arm-linux-gcc文件名过长,导致当前工作路径名过长,不美观。现象如下:

gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ranlib
gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc-ar
gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc-nm
gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc-ranlib
gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-size
gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-dwp
root@ubuntu-GCP1820-SS:~/xilinx_petalinux/gcc-arm-linux$ ls
gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf  gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf.tar.xz
root@ubuntu-GCP1820-SS:~/xilinx_petalinux/gcc-arm-linux$ cd gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/
root@ubuntu-GCP1820-SS:~/xilinx_petalinux/gcc-arm-linux/gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf$

二、解决方案

打开当前用户的.bashrc文件,将图中所示的三个小写w改为大写W。
在这里插入图片描述
修改后如下:

root@ubuntu-GCP1820-SS:~/xilinx_petalinux/gcc-arm-linux/gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf$ vim ~/.bashrc 
 59 if [ "$color_prompt" = yes ]; then
 60     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '
 61 else
 62     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ '
 63 fi
 64 unset color_prompt force_color_prompt
 65 
 66 # If this is an xterm set the title to user@host:dir
 67 case "$TERM" in
 68 xterm*|rxvt*)
 69     PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \W\a\]$PS1"
 70     ;;
 71 *)
 72     ;;
 73 esac
 74 
 75 # enable color support of ls and also add handy aliases
 76 if [ -x /usr/bin/dircolors ]; then
 77     test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
root@ubuntu-GCP1820-SS:~/xilinx_petalinux/gcc-arm-linux/gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf$ source ~/.bashrc 
root@ubuntu-GCP1820-SS:gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf$ 

已解决。
w是当前完整的工作路径;
W是指当前目录。

举报

相关推荐

路径操作 合法路径名

0 条评论