Results 1 to 2 of 2

Thread: BASH: Passing array of strings to function

  1. #1
    Join Date
    2022-Jun
    Posts
    4

    Question BASH: Passing array of strings to function

    Hi there,

    I saw that several values can be passed to functions using "{}". Basically I would like to call a function with an array of strings, such as

    Code:
    my_func() {
       do_something_with $1
    }
    
    my_func {"a" "b" "c"}
    I expected the function my_func being called three times and each time another entry of the array would be passed. Am I wrong?

    Thanks

  2. #2
    Join Date
    2021-May
    Posts
    316

Similar Threads

  1. Blackscreen after passing the Grub Boot loader
    By Creep in forum General Archive
    Replies: 0
    Last Post: 2020-03-26, 19:20
  2. Replies: 0
    Last Post: 2017-05-03, 14:47
  3. Looking for patterns in strings
    By St0ner1995 in forum General Archive
    Replies: 6
    Last Post: 2016-11-12, 11:34

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •