Kevin Jung
Kevin Jung

Reputation: 1

Bash Shell - problems with quoting

I have a problem in this line:

--description=\""$(<$varLeer/media/festplatte/txt/$varDesc)\""

I want it to get out the following:

--description="$(<$varLeer/media/festplatte/txt/$varDesc)"

But how do I get it that it does not "make use" of the letters "$(< and )" ? I hope you understand what I mean. I read this tutorial (http://wiki.bash-hackers.org/syntax/quoting) but I don't understand how I can write down the "$(< and the )" without the shell using it "as Code".

To get maybe a bit clearer, I want to get the second code to be shwon but with the "$(< )" but marked as "real code".

What I tried is this - but it did not work:

--description=\"$(<"$varLeer/media/festplatte/txt/$varDesc\")"

//EDIT: Lets be much clearer at what I want to do. There is a phyton script called "youtube-uploader" (https://code.google.com/p/youtube-upload/wiki/Readme). Now that I don't have to write "youtube-upload ....... INSERT VERY MUCH HERE ;)" every video I want that the uploaded parts get their title, description etc automatically. My idea was to just open my ytscript.bash with nano, edit the first top variables and then just do "sh ytscript.bash", insert my password and relax.

The part would be +1 every time the loop is used and with this there is automatically an own fitting title for every part. Here is my code so far:

#!/bin/bash

# Variablen
varSpielart="Lets Play: "
varSpielname="Diablo 3 "
varParttext="- PART "
varStartpart=1
varEndpart=2
varExtras=" [PS4][1080p]"
varKategorie=Games
varDesc="lpd3desc.txt"

varDateiname=lpd3
varDateiendung=.m4v
varKeywords="ps4, spieleule, piupload"
varPlaylist="UNDEFINIERT"

varAnzahlparts=`expr $varEndpart - $varStartpart`
varLeer=" "

echo "Gebe dein Passwort ein!"
read varPasswort

echo YT-UPLOAD: BEGINNE NEUEN UPLOAD
echo YT-UPLOAD: SPIEL $varSpielname
echo YT-UPLOAD: ANZAHL PARTS: $varAnzahlparts

varDurchgang=$varStartpart

while [ $varEndpart -gt $varDurchgang ]
do
cd youtube-upload
youtube-upload --email="[email protected]" --password=$varPasswort --private --category=$varKategorie --title=\""$varSpielart$varSpielname$varParttext$varDurchgang$varExtras\"" \
--description=$(<$varLeer/media/festplatte/txt/$varDesc) \
/media/festplatte/upload/$varDateiname"p"$varDurchgang""$varDateiendung &
varDurchgang=`expr $varDurchgang + 1`
echo Durchgang: $varDurchgang
echo Entpart: $varEndpart
echo Startpart: $varStartpart
echo Anzahlparts: $varAnzahlparts
done

The automatically title works like a charm (except giving me a " at the start and the end of the title on youtube.com without me wanting it! :( ). The description on youtube.com only gets a "" in it with the first answer under this question.

Upvotes: 0

Views: 86

Answers (2)

Arnab Nandy
Arnab Nandy

Reputation: 6712

Try this

temp='$(<'$varLeer'/media/festplatte/txt/'$varDesc')'

--description=$temp

Upvotes: 0

Sven van de Scheur
Sven van de Scheur

Reputation: 1913

Try single quotes:

--description='"$(<$varLeer/media/festplatte/txt/$varDesc)"'

Upvotes: 1

Related Questions