Return code to error

Not sure how to force the error while unzipping the file to fail.
I tried below and it doesnt work

@Siva2023 , your question is confusing imo.

unzipping a file does not cause anything to be removed per-se but you may be prompted by zip if you want to replace/ignore etc.
be concise - show outputs and EXPECTED result of any/all commands.

statements like 'I tried below and it doesn't work' is pretty useless without showning the actual commands being run

the 'print' command (if existing) is typically for sending a file to a printer , you are probably looking for the printf shell command

for example

#
# below i've created a directory with no write permission
#
unzip myzip.zip || printf "%d - could not unzip\n" $?
Archive:  myzip.zip
error:  cannot create center.css
        Permission denied
error:  cannot create test.html
        Permission denied
error:  cannot create title
        Permission denied
50 - could not unzip

You may be out of disk space while unzipping happened. IMHO.
Please see

@dextergenious, as @Siva2023 has now edited their initial post and not shown outputs I think we can safely assume they've resolved their challenge.

As an aside, below is what would typically happen if running out of space whilst unzipping

#1m temp file system for this demo

df .
Filesystem     1K-blocks  Used Available Use% Mounted on
/dev/loop0           992    24       900   3% /home/munke/tmp/example/myMount

unzip ../myzip.zip || printf "%d - could not unzip\n" $?
Archive:  ../myzip.zip
  inflating: awk.info
  inflating: bash.info
 extracting: expect.info
  inflating: find.info
  inflating: gcc.info
gcc.info:  write error (disk full?).  Continue? (y/n/^C) y
 bad CRC f82fcf9b  (should be c69dba29)
  inflating: gdb.info
gdb.info:  write error (disk full?).  Continue? (y/n/^C) n

warning:  gdb.info is probably truncated
50 - could not unzip

ls -al
total 924
drwxr-xrwx 3 root        root          4096 Mar  6 23:36 ./
drwxrwxr-x 3 munke munke   4096 Mar  6 23:32 ../
-rw-rw-r-- 1 munke munke  94414 Mar  6 23:31 awk.info
-rw-rw-r-- 1 munke munke 328909 Mar  6 23:31 bash.info
-rw-rw-r-- 1 munke munke      0 Mar  6 23:31 expect.info
-rw-rw-r-- 1 munke munke  73324 Mar  6 23:29 find.info
-rw-rw-r-- 1 munke munke 417792 Mar  6 23:31 gcc.info
-rw-rw-r-- 1 munke munke      0 Mar  6 23:31 gdb.info
drwx------ 2 root        root         16384 Mar  6 23:26 lost+found/

# and we can see the device is saturated

df .
Filesystem     1K-blocks  Used Available Use% Mounted on
/dev/loop0           992   924         0 100% /home/munke/tmp/example/myMount
2 Likes