When you use bash to move sample.sh below, an error is generated with a special variable that substitutes the variable.
Probably because it is treated as a string, I don't think I can pull the arguments. Is there any way to do this?
[root@test]#cat sample.sh
#!/bin/bash
echo$2
echo${2}
N = 2
echo${$N}
[root@test] #sh sample.sh abc
B
B
sample.sh: line 8: ${$N}: incorrect substitution
#!/bin/bash
echo$2
echo${2}
N = 2
echo${!N}
so that
% ./sample.sh foo bar
bar
bar
bar
can be achieved.
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
581 PHP ssh2_scp_send fails to send files as intended
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.