V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
thinker3
V2EX  ›  macOS

Mac 下百度同步盘名字就这是这个,中文的,在 terminal 下不好操作,怎么改成英文的?

  •  
  •   thinker3 · 2014-11-03 11:04:03 +08:00 · 3852 次点击
    这是一个创建于 3470 天前的主题,其中的信息可能已经有所发展或是发生改变。
    11 条回复    2014-11-04 13:02:43 +08:00
    sneezry
        1
    sneezry  
       2014-11-03 11:07:01 +08:00 via iPhone
    别名?
    thinker3
        2
    thinker3  
    OP
       2014-11-03 11:16:13 +08:00
    @sneezry 似乎可以,虽然看到那一串问号有点烦
    caiych
        3
    caiych  
       2014-11-03 11:27:39 +08:00
    function echo_and_go() {
    echo $*
    $*
    }

    alias baidu='echo_and_go ~/百度云同步盘'

    可以直接 baidu 进入目录,也可以 `baidu`/sub_dir 进入子目录
    我的rc里配了一堆这样的东西…
    仅供参考…………
    thinker3
        4
    thinker3  
    OP
       2014-11-03 11:41:30 +08:00
    @sneezry 我理解成 ln -sf,而不是alias
    zjjhsyq
        5
    zjjhsyq  
       2014-11-03 12:13:02 +08:00
    百度云不支持软链接到百度云同步盘的文件夹同步让我很蛋疼。。。
    wudaown
        6
    wudaown  
       2014-11-03 12:41:17 +08:00 via iPhone
    分享神器chsdir...
    https://code.google.com/p/easyscripts/wiki/chsdir
    mac的解决方案我在哪里吗贴出来了
    urmyfaith
        7
    urmyfaith  
       2014-11-03 13:18:53 +08:00
    3L,alias的命令似乎可以。我也试试,烦死中文名的处理了。
    = =
    learnshare
        8
    learnshare  
       2014-11-03 13:33:25 +08:00
    我想起了 Android 设置系统语言为 English,没几个软件能换个哪怕只是个英文名的
    JConlee
        9
    JConlee  
       2014-11-03 13:50:23 +08:00
    我直接给同步文件夹做了个“硬连接”,方便以后操作。因为很多软件(比如vim)不能读取中文文件夹下的配置文件。

    下面是以前摘抄在evernote里的方法:

    Snow Leopard can create hard links to directories as long as you follow Amit Singh's six rules:

    1. The file system must be journaled HFS+.
    2. The parent directories of the source and destination must be different.
    3. The source’s parent must not be the root directory.
    4. The destination must not be in the root directory.
    5. The destination must not be a descendent of the source.
    6. The destination must not have any ancestor that’s a directory hard link.

    You can't do it directly in BASH then. However... I found an article here that discusses how to do it indirectly:http://www.mactech.com/articles/mactech/Vol.23/23.11/ExploringLeopardwithDTrace/index.html by compiling a simple little C program:

    #include <unistd.h>#include <stdio.h>
    int main(int argc, char *argv[]){
    if (argc != 3) return 1;
    int ret = link(argv[1], argv[2]);
    if (ret != 0) perror("link");
    return ret;}

    ...and build in Terminal.app with:
    $ gcc -o hlink hlink.c -Wall

    给文件夹 "你好" 创建硬链接 "B":
    sudo ./hlink /Users/Biao/Desktop/你好 /Users/Biao/B

    Here is the "hunlink.c" program:
    #include <stdio.h>
    int
    main(int argc, char *argv[]){
    if (argc != 2)
    return 1;
    int ret = unlink(argv[1]);
    if (ret != 0)
    perror("unlink");
    return ret;}

    gcc -o hunlink hunlink.c

    删除文件夹 "你好" 的硬链接:
    sudo ./hunlink /Users/Biao/B
    hr6r
        10
    hr6r  
       2014-11-04 12:05:05 +08:00   ❤️ 1
    改这个文件 ~/Library/Application Support/百度云同步盘/587e*****/macosnetdisk.plist
    thinker3
        11
    thinker3  
    OP
       2014-11-04 13:02:43 +08:00
    @hr6r 正解
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   743 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 21:18 · PVG 05:18 · LAX 14:18 · JFK 17:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.