Skip to main content
deleted 65 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 238

I am a noob in Linux hence this might come as a silly question. I have a Windows system, so I downloaded cygwin to help me execute Linux/unix commands. I need to execute a shell script on a bunch of apks stored inside a folder (got the script here).

This is the script:

#!/bin/bash
cd $1

for filename in *.apk
do
    unzip -d $filename.extract $filename META-INF/CERT.RSA
    if [ -f $filename.extract/META-INF/CERT.RSA ]
        then
        mkdir `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`
        mv $filename `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/$filename
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/`echo $filename | sed 's/\(.*\.\)apk/\1odex/'`
        rm -rf $filename.extract
    else
        mkdir none
        mv $filename none
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` none
        rm -rf $filename.extract
    fi
done;

mkdir other
mv * other
mv other/b399 platform
mv other/f2a7 shared
mv other/f2b9 media
mv other/936e test

In the terminal I execute the command sh cert.sh,but I get the below error:

enter image description here

Strangely,when I execute cert.sh - the script runs and separates my apks into different folders,but I am not sure if it runs correctly as the proper command to run a shell script is sh cert.sh.

I am a noob in Linux hence this might come as a silly question. I have a Windows system, so I downloaded cygwin to help me execute Linux/unix commands. I need to execute a shell script on a bunch of apks stored inside a folder (got the script here).

This is the script:

#!/bin/bash
cd $1

for filename in *.apk
do
    unzip -d $filename.extract $filename META-INF/CERT.RSA
    if [ -f $filename.extract/META-INF/CERT.RSA ]
        then
        mkdir `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`
        mv $filename `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/$filename
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/`echo $filename | sed 's/\(.*\.\)apk/\1odex/'`
        rm -rf $filename.extract
    else
        mkdir none
        mv $filename none
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` none
        rm -rf $filename.extract
    fi
done;

mkdir other
mv * other
mv other/b399 platform
mv other/f2a7 shared
mv other/f2b9 media
mv other/936e test

In the terminal I execute the command sh cert.sh,but I get the below error:

enter image description here

Strangely,when I execute cert.sh - the script runs and separates my apks into different folders,but I am not sure if it runs correctly as the proper command to run a shell script is sh cert.sh.

I have a Windows system, so I downloaded cygwin to help me execute Linux/unix commands. I need to execute a shell script on a bunch of apks stored inside a folder (got the script here).

This is the script:

#!/bin/bash
cd $1

for filename in *.apk
do
    unzip -d $filename.extract $filename META-INF/CERT.RSA
    if [ -f $filename.extract/META-INF/CERT.RSA ]
        then
        mkdir `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`
        mv $filename `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/$filename
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/`echo $filename | sed 's/\(.*\.\)apk/\1odex/'`
        rm -rf $filename.extract
    else
        mkdir none
        mv $filename none
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` none
        rm -rf $filename.extract
    fi
done;

mkdir other
mv * other
mv other/b399 platform
mv other/f2a7 shared
mv other/f2b9 media
mv other/936e test

In the terminal I execute the command sh cert.sh,but I get the below error:

enter image description here

Strangely,when I execute cert.sh - the script runs and separates my apks into different folders,but I am not sure if it runs correctly as the proper command to run a shell script is sh cert.sh.

added 2 characters in body; edited tags; edited title
Source Link
Gilles 'SO- stop being evil'
  • 865.4k
  • 205
  • 1.8k
  • 2.3k

Executing a shell Shell script to work on files in linuxsome directory

I am a noob in linuxLinux hence this might come as a silly question. I have a windowsWindows system,so so I downloaded cygwin to help me execute linuxLinux/unix commands.I I need to execute a shell script on a bunch of apks stored inside a folder (got the script here).

This is the script:

#!/bin/bash
cd $1

for filename in *.apk
do
    unzip -d $filename.extract $filename META-INF/CERT.RSA
    if [ -f $filename.extract/META-INF/CERT.RSA ]
        then
        mkdir `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`
        mv $filename `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/$filename
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/`echo $filename | sed 's/\(.*\.\)apk/\1odex/'`
        rm -rf $filename.extract
    else
        mkdir none
        mv $filename none
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` none
        rm -rf $filename.extract
    fi
done;

mkdir other
mv * other
mv other/b399 platform
mv other/f2a7 shared
mv other/f2b9 media
mv other/936e test

In the terminal I execute the command sh cert.sh,but I get the below error:

enter image description here

Strangely,when I execute cert.sh - the script runs and separates my apks into different folders,but I am not sure if it runs correctly as the proper command to run a shell script is sh cert.sh.

Executing a shell script in linux

I am a noob in linux hence this might come as a silly question. I have a windows system,so I downloaded cygwin to help me execute linux/unix commands.I need to execute a shell script on a bunch of apks stored inside a folder (got the script here).

This is the script:

#!/bin/bash
cd $1

for filename in *.apk
do
    unzip -d $filename.extract $filename META-INF/CERT.RSA
    if [ -f $filename.extract/META-INF/CERT.RSA ]
        then
        mkdir `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`
        mv $filename `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/$filename
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/`echo $filename | sed 's/\(.*\.\)apk/\1odex/'`
        rm -rf $filename.extract
    else
        mkdir none
        mv $filename none
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` none
        rm -rf $filename.extract
    fi
done;

mkdir other
mv * other
mv other/b399 platform
mv other/f2a7 shared
mv other/f2b9 media
mv other/936e test

In the terminal I execute the command sh cert.sh,but I get the below error:

enter image description here

Strangely,when I execute cert.sh - the script runs and separates my apks into different folders,but I am not sure if it runs correctly as the proper command to run a shell script is sh cert.sh.

Shell script to work on files in some directory

I am a noob in Linux hence this might come as a silly question. I have a Windows system, so I downloaded cygwin to help me execute Linux/unix commands. I need to execute a shell script on a bunch of apks stored inside a folder (got the script here).

This is the script:

#!/bin/bash
cd $1

for filename in *.apk
do
    unzip -d $filename.extract $filename META-INF/CERT.RSA
    if [ -f $filename.extract/META-INF/CERT.RSA ]
        then
        mkdir `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`
        mv $filename `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/$filename
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/`echo $filename | sed 's/\(.*\.\)apk/\1odex/'`
        rm -rf $filename.extract
    else
        mkdir none
        mv $filename none
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` none
        rm -rf $filename.extract
    fi
done;

mkdir other
mv * other
mv other/b399 platform
mv other/f2a7 shared
mv other/f2b9 media
mv other/936e test

In the terminal I execute the command sh cert.sh,but I get the below error:

enter image description here

Strangely,when I execute cert.sh - the script runs and separates my apks into different folders,but I am not sure if it runs correctly as the proper command to run a shell script is sh cert.sh.

fix code block; use syntax highlighting and code escapes
Source Link

I am a noob in linux hence this might come as a silly question. I have a windows system,so I downloaded cygwin to help me execute linux/unix commands.I need to execute a shell script on a bunch of apks stored inside a folder  (got the script from here: http://www.modaco.com/topic/329285-signing-roms-with-the-aosp-platform-cert-for-flibblesan/?p=2221979here  ).

    #!/bin/bash

    cd $1

    for filename in *.apk
    do
            unzip -d $filename.extract $filename META-INF/CERT.RSA
            if [ -f $filename.extract/META-INF/CERT.RSA ]
            then
                    mkdir `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`
                    mv $filename `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/$filename
                    mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/`echo $filename | sed 's/\(.*\.\)apk/\1odex/'`
                    rm -rf $filename.extract
            else
                    mkdir none
                    mv $filename none
                    mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` none
                    rm -rf $filename.extract
            fi
    done;

    mkdir other
    mv * other
    mv other/b399 platform
    mv other/f2a7 shared
    mv other/f2b9 media
    mv other/936e test
#!/bin/bash
cd $1

for filename in *.apk
do
    unzip -d $filename.extract $filename META-INF/CERT.RSA
    if [ -f $filename.extract/META-INF/CERT.RSA ]
        then
        mkdir `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`
        mv $filename `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/$filename
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/`echo $filename | sed 's/\(.*\.\)apk/\1odex/'`
        rm -rf $filename.extract
    else
        mkdir none
        mv $filename none
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` none
        rm -rf $filename.extract
    fi
done;

mkdir other
mv * other
mv other/b399 platform
mv other/f2a7 shared
mv other/f2b9 media
mv other/936e test

In the terminal I execute the command - sh cert.sh sh cert.sh,but I get the below error:

Strangely,when I execute 'cert.sh -'cert.sh - the script runs and separates my apks into different folders,but I am not sure if it runs correctly as the proper command to run a shell script is sh cert.sh.

Kindly please help me to execute this script properlysh cert.sh.

I am a noob in linux hence this might come as a silly question. I have a windows system,so I downloaded cygwin to help me execute linux/unix commands.I need to execute a shell script on a bunch of apks stored inside a folder(got the script from here: http://www.modaco.com/topic/329285-signing-roms-with-the-aosp-platform-cert-for-flibblesan/?p=2221979  )

    #!/bin/bash

    cd $1

    for filename in *.apk
    do
            unzip -d $filename.extract $filename META-INF/CERT.RSA
            if [ -f $filename.extract/META-INF/CERT.RSA ]
            then
                    mkdir `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`
                    mv $filename `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/$filename
                    mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/`echo $filename | sed 's/\(.*\.\)apk/\1odex/'`
                    rm -rf $filename.extract
            else
                    mkdir none
                    mv $filename none
                    mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` none
                    rm -rf $filename.extract
            fi
    done;

    mkdir other
    mv * other
    mv other/b399 platform
    mv other/f2a7 shared
    mv other/f2b9 media
    mv other/936e test

In the terminal I execute the command - sh cert.sh ,but I get the below error:

Strangely,when I execute 'cert.sh -' the script runs and separates my apks into different folders,but I am not sure if it runs correctly as the proper command to run a shell script is sh cert.sh.

Kindly please help me to execute this script properly.

I am a noob in linux hence this might come as a silly question. I have a windows system,so I downloaded cygwin to help me execute linux/unix commands.I need to execute a shell script on a bunch of apks stored inside a folder  (got the script here).

#!/bin/bash
cd $1

for filename in *.apk
do
    unzip -d $filename.extract $filename META-INF/CERT.RSA
    if [ -f $filename.extract/META-INF/CERT.RSA ]
        then
        mkdir `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`
        mv $filename `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/$filename
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/`echo $filename | sed 's/\(.*\.\)apk/\1odex/'`
        rm -rf $filename.extract
    else
        mkdir none
        mv $filename none
        mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` none
        rm -rf $filename.extract
    fi
done;

mkdir other
mv * other
mv other/b399 platform
mv other/f2a7 shared
mv other/f2b9 media
mv other/936e test

In the terminal I execute the command sh cert.sh,but I get the below error:

Strangely,when I execute cert.sh - the script runs and separates my apks into different folders,but I am not sure if it runs correctly as the proper command to run a shell script is sh cert.sh.

Source Link
Loading