I have two compiled.c files and I am trying to take the exit status of the first and use it as an arg to the next one.
#!/bash/bin
./decipher $1
key = $?
./cipher $key $1 $2
This is what I am typing on the command line $./decryption_tool.bs ceaser1.txt output.txt
.ceaser1.txt is an encrypted message and decipher will return a key and cipher should take that key and unencrypt it. Both files work outside of the script as well, but when i use the script I get this error.
./decryption_tool.bs: line 4: key: command not found
./decryption_tool.bs: line 5: 5937 Segmentation fault (core dumped) ./cipher $key $1 $2
Thanks for any help.
Few things wrong:
key=$?
instead of key = $?
#!/bash/bin
, but #!/bin/bash
or even better #!/usr/bin/env bash
./cipher "$key" "$1" "$2"
.bs
? For shell script it's .sh
and Bash doesn't have its own separate version
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.