有人能让我知道如何读取某些数据的二进制文件并将数据写入shell脚本中的新二进制文件吗?我正在使用Linux。
注意:cat file1 > file2:不是必需的,因为这会写入完整的数据。
要求:读一些数据,写一遍,读一遍,写。
while read -n1 ch
do
cat $ch > $output # Tried this, showing error. While writing the data after reading, cat command throws error : No such file or directory.
所以我的Dockerfile是这样写的:
# set env vars for linux user
ENV LINUX_USER="kbuser"
...
... # other stuff
...
USER kbuser
但我想用
USER $LINUX_USER
所以我只需要在文件中的一个地方写用户名。但这不管用。
我怎么才能避开这一切?
谢谢。
我在Linux Command Line and Shell Scripting Bible by Richard Blum Christine Bresnahan上读到:
从对象的完全权限集中减去umask值。文件的完全权限为模式666,但对于目录则为777。
因此,如果一个文件不能同时具有读、写、执行权限,那么用户每次需要执行操作时都必须更改文件吗?如果一个程序员需要测试他的代码,他应该怎么做?其他类型的文件呢?提前谢谢。
我需要用Python3写一个程序,它可以过滤Linux shell中的txt文件,只有三个字母的单词。
这是我到目前为止所得到的:
def main():
string = open("verhaaltje.txt", "r")
words = [word for word in string.split() if len(word)==3]
file.close()
print (str(words))
main()
有谁能帮上忙吗?