2016-03-30 28 views
0

Komut satırında bir eğitici yapıyorum. Egzersizlerden birinde, sonnet ve echo'u kopyalayıp yeni bir dosyaya yapıştırmam gerekiyor. Sorun şu ki, yeni dosyada yeni satırlar mevcut değil, aslında, ben cat dosya, her ayet bir öncekine ekli.kopyalayın, yapıştırın ve yeni satırları kapsayan txt dosyasına eko

Her satırın sonunda el ile "\n"'u eklemek zorunda mıyım? Ben daha iyi bir yol yoktur umut GÜNCELLEME

(1000 çizgiler vardır ne olur çünkü?): Bu ben here gelen sone kopyalamak şimdi

Birinci dek yaptığımız budur.

~$ echo "FRom faireſt creatures we deſire increaſe, That thereby beauties Roſe might neuer die, But as the riper ſhould by time deceaſe, His tender heire might beare his memory: But thou contracted to thine owne bright eyes, Feed’ſt thy lights flame with ſelfe ſubſtantiall fewell, Making a famine where aboundance lies, Thy ſelfe thy foe,to thy ſweet ſelfe too cruell: Thou that art now the worlds freſh ornament, And only herauld to the gaudy ſpring, Within thine owne bud burieſt thy content, And tender chorle makſt waſt in niggarding: Pitty the world,or elſe this glutton be, To eate the worlds due,by the graue and thee." > sonnet.txt 

nihayet içeriğini kontrol: Sonra bu komutu yazmak için terminalde yapıştırın

cat sonnet.txt 

ama olsun:

FRom faireſt creatures we deſire increaſe, That thereby beauties Roſe might neuer die, But as the riper ſhould by time deceaſe, His tender heire might beare his memory: But thou contracted to thine owne bright eyes, Feed’ſt thy lights flame with ſelfe ſubſtantiall fewell, Making a famine where aboundance lies, Thy ſelfe thy foe,to thy ſweet ſelfe too cruell: Thou that art now the worlds freſh ornament, And only herauld to the gaudy ſpring, Within thine owne bud burieſt thy content, And tender chorle makſt waſt in niggarding: Pitty the world,or elſe this glutton be, To eate the worlds due,by the graue and thee. 
+0

_copy-paste a sonnet_ alamadım. _sonnet_ bir karakter dosyası mı yoksa başka bir şey mi? – Mahendra

+0

Bunu yapmak için hangi komutu kullanıyorsunuz? echo [yapıştır]> dosya '? Yapıştırılan içeriklerin her ayet arasında boş satırları var mı? –

+0

@Mahendra, Üzgünüm, – Pigna

cevap

0

bu soneler için çalışacaktır :)

$ sonnet="Shall I compare thee to a summer.s day? 
> Thou art more lovely and more temperate. 
> Rough winds do shake the darling buds of May," 

$ echo "$sonnet" 
Shall I compare thee to a summer.s day? 
Thou art more lovely and more temperate. 
Rough winds do shake the darling buds of May, 

D ouble tırnaklar.

$ echo $sonnet 
Shall I compare thee to a summer.s day? Thou art more lovely and more temperate. Rough winds do shake the darling buds of May, 
+0

adlı bağlantıyı eklemeyi unuttum. Lütfen bağlantıya bakın (daha önce koymayı unuttum). Kopyalayıp yapıştırmayı ve ardından bir txt dosyasına eklemeyi deneyin. Yeni satırları nasıl saklıyorsunuz? – Pigna

+0

hangi sone/metin kullandığınız önemli değil. Alıntılara dikkat ettin mi? Hem değişkeni tanımlarken, hem de tekrar yankılanırken. Lütfen orijinal yayında kullandığınız komutları gönderin. Belki de başka bir şey yapıyorsunuz ... – karakfa

+0

1. sayfadaki son ağı vurgulayın, 2. ctrl-c, 3. "echo" terminaline yazın, 4. "$ [paste]" yazın, 5. yazın " > sonnet.txt ", 6. tıklamayı tıklayın – Pigna

İlgili konular