本帖最后由 shc 于 2021-12-6 12:12 编辑
这样一条命令:
- apt-add-repository -s -y ‘deb http://archive.ubuntu.com/ubuntu/ ‘$OS’ main restricted’
复制代码
这里OS的值是focal
然后,我在Shell里面直接执行,结果如下:
- Hit:1 http://asi-fs-l.contabo.net/ubuntu focal InRelease
- Get:2 http://asi-fs-l.contabo.net/ubuntu focal-updates InRelease [114 kB]
- Get:3 http://asi-fs-l.contabo.net/ubuntu focal-backports InRelease [108 kB]
- Get:4 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
- Get:5 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
- Get:6 http://archive.ubuntu.com/ubuntu focal/main Sources [847 kB]
- Get:7 http://archive.ubuntu.com/ubuntu focal/restricted Sources [6,472 B]
- Get:8 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
- Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [970 kB]
- Get:10 http://archive.ubuntu.com/ubuntu focal/main Translation-en [506 kB]
- Get:11 http://archive.ubuntu.com/ubuntu focal/main amd64 c-n-f Metadata [29.5 kB]
- Get:12 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [22.0 kB]
- Get:13 http://archive.ubuntu.com/ubuntu focal/restricted i386 Packages [8,112 B]
- Get:14 http://archive.ubuntu.com/ubuntu focal/restricted Translation-en [6,212 B]
- Get:15 http://archive.ubuntu.com/ubuntu focal/restricted amd64 c-n-f Metadata [392 B]
- Fetched 3,714 kB in 2s (2,213 kB/s)
复制代码
如果我放在.sh文件里面执行,结果如下:
- Hit:1 http://asi-fs-l.contabo.net/ubuntu focal InRelease
- Get:2 http://asi-fs-l.contabo.net/ubuntu focal-updates InRelease [114 kB]
- Get:3 http://asi-fs-l.contabo.net/ubuntu focal-backports InRelease [108 kB]
- Get:4 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
- Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
- Get:6 http://archive.ubuntu.com/ubuntu bionic/main Sources [829 kB]
- Get:7 http://archive.ubuntu.com/ubuntu bionic/restricted Sources [5,324 B]
- Get:8 http://archive.ubuntu.com/ubuntu bionic/main i386 Packages [1,007 kB]
- Get:9 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1,019 kB]
- Get:10 http://archive.ubuntu.com/ubuntu bionic/main Translation-en [516 kB]
- Get:11 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [9,184 B]
- Get:12 http://archive.ubuntu.com/ubuntu bionic/restricted i386 Packages [9,156 B]
- Get:13 http://archive.ubuntu.com/ubuntu bionic/restricted Translation-en [3,584 B]
- Fetched 3,977 kB in 2s (2,254 kB/s)
复制代码
为啥结果会不一样呢?研究了一个小时了,也没想明白原因……求大佬解答……
感谢 |