Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8951537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:41:15+00:00 2026-06-15T13:41:15+00:00

I have this script, that does several operations on some files, which then creates

  • 0

I have this script, that does several operations on some files, which then creates an output file in the end called flashable.zip.
I’d like to implement that when the user runs the script, it begins with asking for a filename to output in the end. The filename is predefined to looking like this: 1.22.33_DA.zip, where the user gets to choose the 1.22.33 part – It’s like version naming the file.. And it has to be strict, so the user don’t use letters in the 1.22.33 part..

I’m sure I can use something like grep for this, but I’m completely lost in how to do it 🙁
And I’m fairly new to bash scripting, so I’m still learning, the script I got might look pretty messy and can probably be cleaned up a bit 🙂

I’m thinking it would just be something that renames the created zipfile when the operations are done, but I’m not sure though..

Here’s my script:

#!/bin/bash


echo ""
echo "[--- Creating flashable zip ---]"
echo ""

tlock=/home/dan/buildtool/flashable/template/system/media/theme/default
dst=/home/dan/buildtool/flashable/system/media/theme/default
src=/home/dan/buildtool/translations/ma-xml-4.0-danish/extras/lockscreen
parent=/home/dan/buildtool/flashable
src2=/home/dan/buildtool/apk_out
home=/home/dan/buildtool

cd $parent
mkdir system
cd system
mkdir app
mkdir framework
mkdir media
cd media
mkdir theme
mkdir audio
cd theme
mkdir default
cd $parent/system/media/audio
mkdir ringtones
mkdir alarms
mkdir notifications
cd $home


for apk in $(<$home/translation_list.txt); do cp -r -f "$src2/$apk" $parent/system/app; done

mv -f $parent/system/app/framework-miui-res.apk $parent/system/framework
cp -f $parent/template.zip $parent/flashable.zip
cp -f -r $parent/template/system/media/audio $parent/system/media

7za u -tzip $tlock/lockscreen.zip $src/advance
cp -f $tlock/lockscreen.zip $tlock/lockscreen
cp -f $tlock/lockscreen $dst
7za a -tzip $parent/flashable.zip $parent/system -mx3

rm -r $parent/system
cd /home/dan/buildtool
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:41:17+00:00Added an answer on June 15, 2026 at 1:41 pm

    This will read in user input and validate the version via regex.

    #!/bin/bash
    echo -n "Enter version and press [ENTER]: "
    read ver
    [[ "$ver" =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] && echo "${ver}_DA.zip" || echo "Invalid"
    

    Output

    Enter version and press [ENTER]: 111.222.333
    111.222.333_DA.zip
    
    Enter version and press [ENTER]: 1.2222.33
    Invalid
    
    Enter version and press [ENTER]: 1.222.3333
    Invalid
    

    Explanation

    • read ver Reads in user input into the ver variable.
    • ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$

      1) ^ Start of string

      2) [0-9] Any digit between 0 and 9

      3) {1,3} Match at least 1 up to 3 characters

      4) \. Match a dot

      5) \.[0-9]{1,3} Repeat pattern twice

      7) $ Match end of string

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple script that does some search and replace. This is basically
I have this content script that downloads some binary data using XHR, which is
I have to write a Matlab script that does this: The input is 2
I have a script that I run which does a lot of tasks and
I have a bash script that does several tasks, including python manage.py syncdb on
I have a sql script that creates several tables, a trigger, and a trigger
I have this script that run to fix my menu bar to the browser
I have this script that collects data from users and I want to check
I have this script that works, but I need to change the format of
I have this jQuery script that works fine: $(select).change(function () { var finalPrice =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.