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 6956457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:52:19+00:00 2026-05-27T14:52:19+00:00

i would like create a menu with kdialog like this kdialog –menu choose your

  • 0

i would like create a menu with kdialog like this

  kdialog --menu "choose your profile"  "\"-vcodec mpeg2\"" "mpeg" 
  "\"vcodec stuff -ab 100ak\"" "avi" "\"-acodec mp3 -ab 128k"\" "mp3"

now

array a contains options
array b contains name of a profile

it seems kdialog has some problem with “-ab” generally it seemes it takes -stuff like an option so it needs to be “\”-vcodec mpeg2\””.

basically my problem is a quoting problem , i have used printf but i can’t get it

this is my code:

a=(-vcodec mp3 -ab 128k, -vcodec mpeg2video -b 1200k -ab 128k -acodec mp3 -r 25 -ar 44100 ) ; b=(mp3, mpg) ; eval kdialog –menu “choose your profile” $(for ((i = 0; i <=$(( ${#a[@]} -1 )) ; i++ )) ; do printf “\\’%s\\’ %s ” “${a[i]}” “${b[i]}” ; done)

solution

file to read $HOME/FFmpeg_profiles.lst

mpeg  -vcodec mpeg2 -ab 1000k 
avi  -vcodec avi -ab 1000k   
mp3 -acodec mp3 -ab 128k

script i did

function_load_profiles(){
k=0
while read line; do 

nameprofile[$k]="$(echo "$line" | awk '{print $1}')"
ffmpegoptionprofile[$k]="$(echo "$line" | awk '{ for(b=2; b<=NF; b++) {printf("%s ", $b)} } ' )"


 k=$(( $k+1 ))
done < "$HOME/FFmpeg_profiles.lst"

}

function_load_profiles 

ARGS="--menu \"choose your profile\" --"
for ((i=0; i<${#nameprofile[@]}; i++)); do
    ARGS="$ARGS \"${ffmpegoptionprofile[$i]}\" \"${nameprofile[$i]}\""
done

SELECTED_OPTIONS=$(echo $ARGS | xargs kdialog)
echo $SELECTED_OPTIONS
  • 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-05-27T14:52:20+00:00Added an answer on May 27, 2026 at 2:52 pm
    #!/bin/bash
    A=("-vcodec mp3 -ab 128k"  
       "-vcodec mpeg2video -b 1200k -ab 128k -acodec mp3 -r 25 -ar 44100")
    B=("mp3" "mpg")
    
    # Build command line args
    ARGS="--menu \"choose your profile\" --"
    for ((i=0; i<${#A[@]}; i++)); do
        ARGS="$ARGS \"${A[$i]}\" \"${B[$i]}\""
    done
    
    SELECTED_OPTIONS=$(echo $ARGS | xargs kdialog)
    echo $SELECTED_OPTIONS
    

    We use xargs to overcome the issue of the quoted options (with spaces) being treated as multiple args instead of a single argument, i.e. “kdialog $ARGS” won’t work as expected.

    xargs is preferable to “eval kdialog $ARGS” as it can avoid command injection.


    Updates

    Based on your updated example where you’re actually loading the values form a text file, you can do the same without the intermediate arrays:

    #!/bin/bash
    PROFILE_FILE="FFmpeg_profiles.lst"
    ARGS="--menu \"choose your profile\" --"
    
    while read PROFILE OPTS; do
        ARGS="${ARGS} \"${OPTS}\" \"${PROFILE}\""
    done < $PROFILE_FILE
    
    echo $ARGS | xargs kdialog
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create a spinning menu akin to the one done in
I am trying to create a css menu. I would like to remove border
I would like to create a jQuery menu with dynamic content using the jQuery
Hey everyone. I would like to create a joomla menu but have it display
I would like to know what is the best solution to create simple menu
I would like to create interactive Python script (probably using curses?) with menu where
I'm trying to create a sliding horizontal menu with different categories. I would like
I would like to create a dynamic menu from following result set. Html structure
I would like to create a custom PopUp menu in Android like the one
I would like to create a drop down menu on top of my google

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.