thinker3
V2EX  ›  macOS

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

  •  
  •   thinker3 · Nov 3, 2014 · 4667 views
    This topic created in 4295 days ago, the information mentioned may be changed or developed.
    11 replies    2014-11-04 13:02:43 +08:00
    sneezry
        1
    sneezry  
       Nov 3, 2014 via iPhone
    别名?
    thinker3
        2
    thinker3  
    OP
       Nov 3, 2014
    @sneezry 似乎可以,虽然看到那一串问号有点烦
    caiych
        3
    caiych  
       Nov 3, 2014
    function echo_and_go() {
    echo $*
    $*
    }

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

    可以直接 baidu 进入目录,也可以 `baidu`/sub_dir 进入子目录
    我的rc里配了一堆这样的东西…
    仅供参考…………
    thinker3
        4
    thinker3  
    OP
       Nov 3, 2014
    @sneezry 我理解成 ln -sf,而不是alias
    zjjhsyq
        5
    zjjhsyq  
       Nov 3, 2014
    百度云不支持软链接到百度云同步盘的文件夹同步让我很蛋疼。。。
    wudaown
        6
    wudaown  
       Nov 3, 2014 via iPhone
    分享神器chsdir...
    https://code.google.com/p/easyscripts/wiki/chsdir
    mac的解决方案我在哪里吗贴出来了
    urmyfaith
        7
    urmyfaith  
       Nov 3, 2014
    3L,alias的命令似乎可以。我也试试,烦死中文名的处理了。
    = =
    learnshare
        8
    learnshare  
       Nov 3, 2014
    我想起了 Android 设置系统语言为 English,没几个软件能换个哪怕只是个英文名的
    f4M9RRTZIKP4yt7O
        9
    f4M9RRTZIKP4yt7O  
       Nov 3, 2014
    我直接给同步文件夹做了个“硬连接”,方便以后操作。因为很多软件(比如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  
       Nov 4, 2014   ❤️ 1
    改这个文件 ~/Library/Application Support/百度云同步盘/587e*****/macosnetdisk.plist
    thinker3
        11
    thinker3  
    OP
       Nov 4, 2014
    @hr6r 正解
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2373 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 95ms · UTC 15:58 · PVG 23:58 · LAX 08:58 · JFK 11:58
    ♥ Do have faith in what you're doing.