Shell scripting help
Hi i am trying to learn shell scripting :)
what does the dollar sign mean, and these signs {} DEST="${DST}`date +%F`/" Thanks |
Hi,
I can't explain it any better than; Quote:
:hattip: Just a few links to aid you; Linux Documentation Project Rute Tutorial & Exposition Linux Command Guide Utimate Linux Newbie Guide LinuxSelfHelp Getting Started with Linux Bash Reference Manual Advanced Bash-Scripting Guide Linux Home Networking :hattip: The above links and others can be found at 'Slackware-Links'. More than just Slackware® links! |
To learn shell scripting, first you have to read a lot. The $ sign and the brackets {} are the basics to manage variables and their values in shell programming.
From the Advanced Bash Scripting Guide, chapter 4.1 (variable substitution) Code:
The name of a variable is a placeholder for its value, the data it holds. Code:
${parameter} |
The $ evokes parameter expansion; read $ as "value of." In your example, the parameter is DST and ${DST} is the value of DST.
{ } braces are optional, except for a:
Hope this helps some. |
The ${} allows you to reference the value of the variable $DST within the literal string. This is only required if there is an alpha numeric character immediately after your variable in the literal string. e.g
brendan@ubuntu:~$ DST="Some text" brendan@ubuntu:~$ echo "$DST followed by some more text" Some text followed by some more text brendan@ubuntu:~$ echo "$DSTimmediately followed by some more text" followed by some more text brendan@ubuntu:~$ echo "${DST}immediately followed by some more text" Some textimmediately followed by some more text The second echo command is trying to reference the value of variable $DSTimmediately rather than $DST. |
Quote:
Code:
c:/tmp$ cat essay.sh |
Quote:
Code:
$ ./essay.sh u 2 3 4 5 6 7 8 9 10 Alex |
Quote:
|
Thanks
Thanks alot :) now i kind of understand, i think:hattip:
|
I am working on my first shell script and i need som help please
I have a folder that i am sharing between my linux server and my windows computer at home with samba. I want that folder not to take up more than 120 gb of my disk space. Can anyone help me on the way how do i accomplish this by a shell script. This is my script so far #!/bin/bash echo "The disk space of the directory blabla" du -h /home/shane/blabla* What i realise when i excecutes the script is, that it shows me the file size name of every files in that directory. Can someone tell me how do i just get the total disk space that is used, i don't want to see whats in the directory only the disc space that is used so far..? Thanks |
Hi,
Look at some of the links that I provided. You need to familiarize yourself with the basic commands. If you want to know the size available for the filesystems then do a; Code:
~#df -h Quote:
:hattip: |
All times are GMT -5. The time now is 11:19 PM. |