Closed. This question is off-topic. It is not currently accepting answers. Learn more
想改进这个问题吗?Update the question所以堆栈溢出的值小于aa>。
6年前关闭。
#!/bin/bash

    selection=
    until [ "$selection" = "0"]; do
     echo ""
     echo "PROGRAM MENU"
     echo "1 - Encrypt text with Rot13"
     echo "2 - DEcrypt text with Rot13"
     echo ""
     echo "0 - Exit program"
     echo ""
     echo -n "Enter Selection:"
     read selection
     echo ""
     case $selection in
         1 ) echo "Line to be encrypted"
         rot13 "a-z"
         2 ) echo "Line to be decrypted"
         rot13 "n-za-m"
         3 ) exit;;
         * ) echo "Please enter 1,2, or 0"
     esac
done

我想读取一个.txt文件,加密它,保存它,然后解密它。

最佳答案

谷歌对“rot13 in bash”的快速搜索显示:using rot13 and tr command for having an encrypted email address
简而言之:

echo '[email protected]' | tr '[A-Za-z]' '[N-ZA-Mn-za-m]'

这应该是ROT13 [email protected]。从这里很容易添加菜单项,给tr一个文件而不是管道,并将输出保存到一个文件。所有其他操作也很容易通过快速搜索找到。

关于linux - 如何在Linux中创建可以使用ROT13解密和加密文件的菜单? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19439274/

10-15 02:22