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

  • Home
  • SEARCH
  • 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 8610979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:15:27+00:00 2026-06-12T04:15:27+00:00

I want a script that I run thusly: logphone Foo Bar Tar:I Baz:D Which

  • 0

I want a script that I run thusly:

logphone Foo Bar Tar:I Baz:D

Which actually runs

adb -d logcat dalvikvm:I ActivityManager:W AndroidRuntime:W Foo:* Bar:* Tar:I Baz:D *:S

How do I do this with any number of parameters? Note that the order somewhat matters (Foo, Bar, etc. can’t be at the end). Bash if it matters.

I can break the steps down to

  1. For any number of command line arguments…
  2. Check each argument for a colon (:)
  3. If there’s no colon add :*, otherwise leave it alone
  4. Inject it into the command line adb logcat dal…time:W __INJECTED_ARGS__ *:S
  • 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-12T04:15:29+00:00Added an answer on June 12, 2026 at 4:15 am

    Try the following bash code. Don’t forget the shebang (if not /bin/bash) and chmod +x script.sh :

    #!/bin/bash
    
    for arg; do
        if [[ "$arg" == *:* ]]; then
            args="$args $arg "
        else
            args="$args $arg:* "
        fi
    done
    
    exec adb -d logcat dalvikvm:I ActivityManager:W AndroidRuntime:W ${args[@]} *:S
    

    If you have a recent bash (see it with bash -version), I can improve it a bit.

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

Sidebar

Related Questions

I have a python script that I want always to run in the background.
I have a Iron Python script that I want to run and then have
I have created one ruby script that I want to run with some flags
I have a .sql script file that I want to run once every 24
I want to run a php script from the command line that is always
I want to run a shell script on startup by google ,I found that
Here is the script that I want to run using git filter-branch : #!/bin/bash
I want to write a PHP script that will run as a cron job
I want to run a php script that will send out a bunch of
I have a zsh script that I want to run such that it also

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.