Skip to main content
Tweeted twitter.com/#!/StackUnix/status/242411836639703042
edited tags; edited tags
Link
Gilles 'SO- stop being evil'
  • 865.4k
  • 205
  • 1.8k
  • 2.3k
Source Link
Arthur Halma
  • 383
  • 2
  • 3
  • 8

Passing arguments with quotes and doublequotes to bash script

At this moment I have:

#!/bin/bash
screen -p 'ScreenName' -x eval 'stuff '"'"$@"'"'\015'
echo eval 'stuff '"'"$@"'"'\015'

But when I call my script as:

# script.sh asd "asd" 'asd'

my arguments passed as: asd asd asd

and I get output:

eval stuff 'asd asd asd'\015

I except a: asd "asd" 'asd'

How I can change my script to pass whole arguments line with all quotes?