I was trying out a very small script
#!/bin/sh
test="$(/home/dell/case3.3/private.key)"
echo $test
I call this file test1.sh
I try to access a file named private.key
Here is the permission set for the file private.key
-rw-rw-r--
Here is the permission set for the file test1.sh
-rwxrwxrwx
I have also tried to do
chmod u+x test1.sh
and
chmod 755 test1.sh
In my agony, I also tried
chmod 777 test1.sh
I believe that 777 should give it all the permissions like it did ..
I don’t understand what the problem is, why is there a permission denied
I act as the super user
/home/dell/case3.3/private.keyis not a script, and not executable.$(/home/dell/case3.3/private.key)tries to execute that file. It’s unclear what you’re trying to do, but perhaps what you want is:Edit in response to OP’s comments
You don’t need to save a whole file to a variable in order to simply display its contents. Instead, use:
If, however, you do want to save off some part of the file, use
sed,grep, orawk. For exampleOr, you could process the file line by line: