Question [Q] Help in making flashable .sh file

Hi Everyone!

I want to make a .sh file which I am going to flash by CWM. I need your help in that.

1) In updater-script, when I extract it to /tmp, what permissions should I give to .sh file by set_perm?

2) I want it to execute "tar" command ("su" command that is root is not required) to operate on file from sdcard (/sdcard).

Can anyone tell me what should be the contents of .sh file.

I don't know much but I created this, and gave (0,0,0777) permissions but I am not getting required result. Please correct my script.

Code:
#!/sbin/sh
#Script to Odinize boot.img by hnkotnis@XDA 2014

cd sdcard
tar -cf boot-sgy.tar boot.img
Above command works when I type it from terminal emulator, but does not work when flashed.

Please help me, I don't know anything about .sh but I have good knowledge of terminal commands & edify commands.