Runing Asterisk command from bash script

I do not know that how I can run asterisk commands without “Asterisk CLI”!!
Is there any solution that I can run commands of “asterisk CLI” from bash or another scripting program??
Because I need to run some command from my script not CLI command.

Thanks in advance

You need to read asterisk documentation, this can be done with “asterisk -rx” or the AMI interface. read the book asterisk the future of telephony.

asterisk -rx 'command’
if you want to see the result of a command in a file:
asterisk -rx ‘command’ > /some_dir/some_file.txt

system qq(asterisk -rx ‘command’)