• We've upgraded our forums. Please post any issues/requests in this thread.

scripting help

Joined
Oct 20, 2009
Messages
2,841 (0.95/day)
Likes
339
System Name FumoffuFumoffu
Processor Intel i7 4770K
Motherboard Gigabyte Z87X -UD3H
Cooling Corsair H100i
Memory 16GB DDR3 1600 Crucial Ballistix
Video Card(s) Sapphire AMD Radeon HD 7970 OC
Storage 1- WD 500GB 1- Samsung F2 1.5TB 1- Crucial M4 128GB SSD 1-256GB ADATA XPG SX900 ASX900S3 SSD
Display(s) Hanns-G HZ281HPB 27.5'' 3ms Full HD 1920x1200 WideScreen LCD Monitor
Case Corsair Graphite Series 600T
Audio Device(s) Creative Soundblaster X-Fi Titanium
Power Supply Corsair HX 750W Gold
Software Windows 7 Pro x64
#1
Hi guys,

I'm not familiar with scripting but I have a task and have found no program to accomplish the task.

I read alot of ebooks in different formats: epub, pdf, rtf, etc
I have different folders for the formats.
I have to move them from the Downloads folder to the respective folders which can be annoying and time consuming since there tend to be quite a few.

I need either a script or a program that can watch my Downloads folder and move the files to the folders.

The path for the downloads folder is /home/ian/Downloads
The path for the RTF folder is: /home/ian/Documents/Fanfiction/RTF
The path for the EPUB folder is: /home/ian/Documents/Fanficiton/EPUB
The path for the PDF folder is: /home/ian/Documents/Fanfiction/PDF
and the path for the HTML folder is: /home/ian/Documents/Fanfiction/HTML

There is a windows program that does this called QuickMove.
 

Mindweaver

Moderato®™
Staff member
Joined
Apr 16, 2009
Messages
6,580 (2.08/day)
Likes
3,913
Location
Charleston, SC
System Name Sechs / EyeSeven
Processor i7 5820k @ 4.5ghz / i7 2600k @ 4.0Ghz
Motherboard X99S GAMING 7 / ASRock Z68 Extreme3 Gen3
Cooling CORSAIR Hydro Series H100i Extreme / Stock cooler... H50 leaked!..
Memory G.Skill DDR4 2800 16GB 4x4GB / G.Skill DDR3 1600 8gb 2x4GB
Video Card(s) PNY Quadro K2000 / MSI GTX 970 GAMING 4Gb
Storage Samsung 850 PRO 256GB SSD /Intel 240gb, corsair 120gb SSD, 3x 1 tb s storage
Display(s) 2x Acer G276HL 27" 1080p / 3x Acer 22" Nvidia surround
Case Phanteks “Enthoo Pro series”/ Cooler Master Storm Scout
Audio Device(s) Azalia Realtek ALC1150 / SB X-Fi Gamer
Power Supply Corsair CXM CX600M / Corsair 600w
Mouse Razer DeathAdder Chroma / Razer DeathAdder
Keyboard Razer BlackWidow Ultimate /
Software Windows 10 Pro x64 / Windows 10 Pro x64
#2
Here is a batch file you can use.

Copy this into a text file and rename the text file to .bat

Code:
@echo off

color 9F
echo ### Mindweaver's File Mover
ECHO ---------------------------
ECHO -
ECHO -
ECHO Select a type of file to move.
ECHO 1. PDF
ECHO 2. RTF
ECHO 3. EPUB
ECHO 4. HTML
ECHO 5. ALL

set PDF=%USERPROFILE%\Downloads\*.pdf
set RTF=%USERPROFILE%\Downloads\*.rtf
set EPUB=%USERPROFILE%\Downloads\*.epub
set HTML=%USERPROFILE%\Downloads\*.html
set folder1=%USERPROFILE%\Documents\PDF
set folder2=%USERPROFILE%\Documents\RTF
set folder3=%USERPROFILE%\Documents\EPUB
set folder4=%USERPROFILE%\Documents\HTML
set Movecmd=Move /y

set /p userinp=choose a number(1-5):
set userinp=%userinp:~0,1%
if "%userinp%"=="1" goto 1
if "%userinp%"=="2" goto 2
if "%userinp%"=="3" goto 3
if "%userinp%"=="4" goto 4
if "%userinp%"=="5" goto 5


:1
CLS
echo ### Moving PDF's
%Movecmd% "%PDF%" "%folder1%"
GOTO EXIT

:2
CLS
echo ### Moving RTF's
%Movecmd% "%RTF%" "%folder2%"
GOTO EXIT

:3
CLS
echo ### Moving EPUB's
%Movecmd% "%EPUB%" "%folder3%"
GOTO EXIT

:4
CLS
echo ### Moving HTML's
%Movecmd% "%HTML%" "%folder4%"
GOTO EXIT

:5
CLS
echo ### Moving PDF's
%Movecmd% "%PDF%" "%folder4%"
echo 25% complete
%Movecmd% "%RTF%" "%folder2%"
echo 50% complete
%Movecmd% "%EPUB%" "%folder3%"
echo 75% complete
%Movecmd% "%HTML%" "%folder4%"
GOTO EXIT

:EXIT
echo Move Complete!
@pause
 
Joined
Oct 20, 2009
Messages
2,841 (0.95/day)
Likes
339
System Name FumoffuFumoffu
Processor Intel i7 4770K
Motherboard Gigabyte Z87X -UD3H
Cooling Corsair H100i
Memory 16GB DDR3 1600 Crucial Ballistix
Video Card(s) Sapphire AMD Radeon HD 7970 OC
Storage 1- WD 500GB 1- Samsung F2 1.5TB 1- Crucial M4 128GB SSD 1-256GB ADATA XPG SX900 ASX900S3 SSD
Display(s) Hanns-G HZ281HPB 27.5'' 3ms Full HD 1920x1200 WideScreen LCD Monitor
Case Corsair Graphite Series 600T
Audio Device(s) Creative Soundblaster X-Fi Titanium
Power Supply Corsair HX 750W Gold
Software Windows 7 Pro x64
#3
This will work in linux right? It looks very close to BASIC
 

Mindweaver

Moderato®™
Staff member
Joined
Apr 16, 2009
Messages
6,580 (2.08/day)
Likes
3,913
Location
Charleston, SC
System Name Sechs / EyeSeven
Processor i7 5820k @ 4.5ghz / i7 2600k @ 4.0Ghz
Motherboard X99S GAMING 7 / ASRock Z68 Extreme3 Gen3
Cooling CORSAIR Hydro Series H100i Extreme / Stock cooler... H50 leaked!..
Memory G.Skill DDR4 2800 16GB 4x4GB / G.Skill DDR3 1600 8gb 2x4GB
Video Card(s) PNY Quadro K2000 / MSI GTX 970 GAMING 4Gb
Storage Samsung 850 PRO 256GB SSD /Intel 240gb, corsair 120gb SSD, 3x 1 tb s storage
Display(s) 2x Acer G276HL 27" 1080p / 3x Acer 22" Nvidia surround
Case Phanteks “Enthoo Pro series”/ Cooler Master Storm Scout
Audio Device(s) Azalia Realtek ALC1150 / SB X-Fi Gamer
Power Supply Corsair CXM CX600M / Corsair 600w
Mouse Razer DeathAdder Chroma / Razer DeathAdder
Keyboard Razer BlackWidow Ultimate /
Software Windows 10 Pro x64 / Windows 10 Pro x64
#4
This will work in linux right? It looks very close to BASIC
Naw.. I quickly copied an old windows batch file I had and posted it for you.. I'm working on a Linux one now.. I have an old Unix one I use to use... Should still work :toast: Sorry buddy and I moved this thread back to the Linux thread.

EDIT: I left the code here for Windows users.. Linux would be something like this for the move command.
Code:
#!/bin/bash
mv from to

You can use CASE instead of GOTO
 
Last edited:

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
10,401 (4.84/day)
Likes
5,481
Location
Concord, NH
System Name Kratos
Processor Intel Core i7 3930k @ 4.2Ghz
Motherboard ASUS P9X79 Deluxe
Cooling Zalman CPNS9900MAX 130mm
Memory G.Skill DDR3-2133, 16gb (4x4gb) @ 9-11-10-28-108-1T 1.65v
Video Card(s) MSI AMD Radeon R9 390 GAMING 8GB @ PCI-E 3.0
Storage 2x120Gb SATA3 Corsair Force GT Raid-0, 4x1Tb RAID-5, 1x500GB
Display(s) 1x LG 27UD69P (4k), 2x Dell S2340M (1080p)
Case Antec 1200
Audio Device(s) Onboard Realtek® ALC898 8-Channel High Definition Audio
Power Supply Seasonic 1000-watt 80 PLUS Platinum
Mouse Logitech G602
Keyboard Rosewill RK-9100
Software Ubuntu 17.10
Benchmark Scores Benchmarks aren't everything.
#5
This will work in linux right? It looks very close to BASIC
The BASH form would be pretty easy.

It would look something like this (I don't think a UI is necessary):

Code:
#!/bin/bash
pathfrom="/path/to/downloads/folder"
pathto="/path/to/store/files"

mv "$pathfrom/*.pdf" "$pathto/PDF"
mv "$pathfrom/*.rtf" "$pathto/RTF"
mv "$pathfrom/*.epub" "$pathto/EPUB"
mv "$pathfrom/*.html" "$pathto/HTML"
Basically is just moves everything it encounters when you run the script. This should work, but I haven't tested it.

Edit: If you wanted a UI, you could easily just add a SWITCH/CASE statement plus a little usage output.

@Mindweaver: Ewww, really? GOTO? :p
 
Joined
Aug 2, 2009
Messages
4,014 (1.31/day)
Likes
1,832
System Name Abacus
Processor i5 2500K
Motherboard ASRock p67 Extreme4 Gen3
Cooling Swiftech MCP35X, EK HF Copper, 2.120 rad, 3.120 rad
Memory 2x4GB G.Skill Sniper 1600
Video Card(s) 2 Zotac GTX 770 4GB w/ FC EK Blocks
Storage WD 640BG x2/WD 250GB/Samsung 2TB
Display(s) QNIX 27" PLS
Case Corsair 700D
Audio Device(s) X-Fi XtremeGamer
Power Supply EVGA G2 750W
Mouse Logitech G500
Keyboard Corsair K70 RGB MX Brown
Software Windows 10
#6
Just use Calibre and convert them into one file type, or keep them all in a single Calibre folder since Calibre will open them all, anyhow.
 
Joined
Oct 20, 2009
Messages
2,841 (0.95/day)
Likes
339
System Name FumoffuFumoffu
Processor Intel i7 4770K
Motherboard Gigabyte Z87X -UD3H
Cooling Corsair H100i
Memory 16GB DDR3 1600 Crucial Ballistix
Video Card(s) Sapphire AMD Radeon HD 7970 OC
Storage 1- WD 500GB 1- Samsung F2 1.5TB 1- Crucial M4 128GB SSD 1-256GB ADATA XPG SX900 ASX900S3 SSD
Display(s) Hanns-G HZ281HPB 27.5'' 3ms Full HD 1920x1200 WideScreen LCD Monitor
Case Corsair Graphite Series 600T
Audio Device(s) Creative Soundblaster X-Fi Titanium
Power Supply Corsair HX 750W Gold
Software Windows 7 Pro x64
#7
Just use Calibre and convert them into one file type, or keep them all in a single Calibre folder since Calibre will open them all, anyhow.
I actually use flagfic to handle it. Then fbreader for the reading. I tried calibre but every time it screws up the format. I like rtf and html but sometimes it looks and reads better through pdf or epub.

****Update****
Here is what I get when I run the script.
Code:
ian@ian-Lenovo-G570:~$ ./quickmove.sh
./quickmove.sh: line 2: pathfrom: command not found
./quickmove.sh: line 3: pathto: command not found
mv: cannot stat `/*.pdf': No such file or directory
mv: cannot stat `/*.rtf': No such file or directory
mv: cannot stat `/*.epub': No such file or directory
mv: cannot stat `/*.html': No such file or directory
ian@ian-Lenovo-G570:~$ ./quickmove.sh
./quickmove.sh: line 2: /home/ian/Downloads: Is a directory
./quickmove.sh: line 3: /home/ian/Documents/Fanfiction: Is a directory
mv: cannot stat `/*.pdf': No such file or directory
mv: cannot stat `/*.rtf': No such file or directory
mv: cannot stat `/*.epub': No such file or directory
mv: cannot stat `/*.html': No such file or directory
ian@ian-Lenovo-G570:~$
Here is the script:
Code:
#!/bin/bash
pathfrom= "/home/ian/Downloads"
pathto= "/home/ian/Documents/Fanfiction"

mv "$pathfrom/*.pdf" "$pathto/PDF"
mv "$pathfrom/*.rtf" "$pathto/RTF"
mv "$pathfrom/*.epub" "$pathto/EPUB"
mv "$pathfrom/*.html" "$pathto/HTML"
 
Last edited:

Mindweaver

Moderato®™
Staff member
Joined
Apr 16, 2009
Messages
6,580 (2.08/day)
Likes
3,913
Location
Charleston, SC
System Name Sechs / EyeSeven
Processor i7 5820k @ 4.5ghz / i7 2600k @ 4.0Ghz
Motherboard X99S GAMING 7 / ASRock Z68 Extreme3 Gen3
Cooling CORSAIR Hydro Series H100i Extreme / Stock cooler... H50 leaked!..
Memory G.Skill DDR4 2800 16GB 4x4GB / G.Skill DDR3 1600 8gb 2x4GB
Video Card(s) PNY Quadro K2000 / MSI GTX 970 GAMING 4Gb
Storage Samsung 850 PRO 256GB SSD /Intel 240gb, corsair 120gb SSD, 3x 1 tb s storage
Display(s) 2x Acer G276HL 27" 1080p / 3x Acer 22" Nvidia surround
Case Phanteks “Enthoo Pro series”/ Cooler Master Storm Scout
Audio Device(s) Azalia Realtek ALC1150 / SB X-Fi Gamer
Power Supply Corsair CXM CX600M / Corsair 600w
Mouse Razer DeathAdder Chroma / Razer DeathAdder
Keyboard Razer BlackWidow Ultimate /
Software Windows 10 Pro x64 / Windows 10 Pro x64
#8
I actually use flagfic to handle it. Then fbreader for the reading. I tried calibre but every time it screws up the format. I like rtf and html but sometimes it looks and reads better through pdf or epub.

****Update****
Here is what I get when I run the script.
Code:
ian@ian-Lenovo-G570:~$ ./quickmove.sh
./quickmove.sh: line 2: pathfrom: command not found
./quickmove.sh: line 3: pathto: command not found
mv: cannot stat `/*.pdf': No such file or directory
mv: cannot stat `/*.rtf': No such file or directory
mv: cannot stat `/*.epub': No such file or directory
mv: cannot stat `/*.html': No such file or directory
ian@ian-Lenovo-G570:~$ ./quickmove.sh
./quickmove.sh: line 2: /home/ian/Downloads: Is a directory
./quickmove.sh: line 3: /home/ian/Documents/Fanfiction: Is a directory
mv: cannot stat `/*.pdf': No such file or directory
mv: cannot stat `/*.rtf': No such file or directory
mv: cannot stat `/*.epub': No such file or directory
mv: cannot stat `/*.html': No such file or directory
ian@ian-Lenovo-G570:~$
Here is the script:
Code:
#!/bin/bash
pathfrom= "/home/ian/Downloads"
pathto= "/home/ian/Documents/Fanfiction"

mv "$pathfrom/*.pdf" "$pathto/PDF"
mv "$pathfrom/*.rtf" "$pathto/RTF"
mv "$pathfrom/*.epub" "$pathto/EPUB"
mv "$pathfrom/*.html" "$pathto/HTML"
Your paths are wrong. Try doing it with out declaring Variables. When you get the path correct then clean up your code and declare variables. :toast:

Code:
#!/bin/bash
mv /home/ian/Downloads /home/ian/Documents/Fanfiction/PDF
mv /home/ian/Downloads /home/ian/Documents/Fanfiction/RTF
mv /home/ian/Downloads /home/ian/Documents/Fanfiction/EPUB
mv /home/ian/Downloads /home/ian/Documents/Fanfiction/HTML
 
Joined
Oct 20, 2009
Messages
2,841 (0.95/day)
Likes
339
System Name FumoffuFumoffu
Processor Intel i7 4770K
Motherboard Gigabyte Z87X -UD3H
Cooling Corsair H100i
Memory 16GB DDR3 1600 Crucial Ballistix
Video Card(s) Sapphire AMD Radeon HD 7970 OC
Storage 1- WD 500GB 1- Samsung F2 1.5TB 1- Crucial M4 128GB SSD 1-256GB ADATA XPG SX900 ASX900S3 SSD
Display(s) Hanns-G HZ281HPB 27.5'' 3ms Full HD 1920x1200 WideScreen LCD Monitor
Case Corsair Graphite Series 600T
Audio Device(s) Creative Soundblaster X-Fi Titanium
Power Supply Corsair HX 750W Gold
Software Windows 7 Pro x64
#9
The BASH form would be pretty easy.

It would look something like this (I don't think a UI is necessary):

Code:
#!/bin/bash
pathfrom="/path/to/downloads/folder"
pathto="/path/to/store/files"

mv "$pathfrom/*.pdf" "$pathto/PDF"
mv "$pathfrom/*.rtf" "$pathto/RTF"
mv "$pathfrom/*.epub" "$pathto/EPUB"
mv "$pathfrom/*.html" "$pathto/HTML"
Basically is just moves everything it encounters when you run the script. This should work, but I haven't tested it.

Edit: If you wanted a UI, you could easily just add a SWITCH/CASE statement plus a little usage output.

@Mindweaver: Ewww, really? GOTO? :p
Your paths are wrong. Try doing it with out declaring Variables. When you get the path correct then clean up your code and declare variables. :toast:

Code:
#!/bin/bash
mv /home/ian/Downloads /home/ian/Documents/Fanfiction/PDF
mv /home/ian/Downloads /home/ian/Documents/Fanfiction/RTF
mv /home/ian/Downloads /home/ian/Documents/Fanfiction/EPUB
mv /home/ian/Downloads /home/ian/Documents/Fanfiction/HTML
Thanks for clearing that up. I found a working solution on bashscripts.org.

Here is my code:
Code:
#!/bin/bash
#Ian's File Moving Script


shopt -s extglob
mv -f $HOME/Downloads/*.pdf $HOME/Documents/Fanfiction/PDF
mv -f $HOME/Downloads/*.rtf $HOME/Documents/Fanfiction/RTF
mv -f $HOME/Downloads/*.epub $HOME/Documents/Fanfiction/EPUB
mv -f $HOME/Downloads/*.html $HOME/Documents/Fanfiction/HTML/NewDownloads/December
The Only thing missing that i have yet to figure out is how to make it not post errors when the file type is not found. Maybe have it say " no .ext found" when there are no files of said extention. And "(x) .ext files moved" when files are moved. the (x) being the number of files under that extension.
 

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
10,401 (4.84/day)
Likes
5,481
Location
Concord, NH
System Name Kratos
Processor Intel Core i7 3930k @ 4.2Ghz
Motherboard ASUS P9X79 Deluxe
Cooling Zalman CPNS9900MAX 130mm
Memory G.Skill DDR3-2133, 16gb (4x4gb) @ 9-11-10-28-108-1T 1.65v
Video Card(s) MSI AMD Radeon R9 390 GAMING 8GB @ PCI-E 3.0
Storage 2x120Gb SATA3 Corsair Force GT Raid-0, 4x1Tb RAID-5, 1x500GB
Display(s) 1x LG 27UD69P (4k), 2x Dell S2340M (1080p)
Case Antec 1200
Audio Device(s) Onboard Realtek® ALC898 8-Channel High Definition Audio
Power Supply Seasonic 1000-watt 80 PLUS Platinum
Mouse Logitech G602
Keyboard Rosewill RK-9100
Software Ubuntu 17.10
Benchmark Scores Benchmarks aren't everything.
#10
The Only thing missing that i have yet to figure out is how to make it not post errors when the file type is not found. Maybe have it say " no .ext found" when there are no files of said extention. And "(x) .ext files moved" when files are moved. the (x) being the number of files under that extension.
add a stderr redirection
mv -f /x/y/z a/b/c 2> /dev/null
That will pipe stderr to nothing. If you want to make a log, then just replace /dev/null with the location of your log.

Your paths are wrong. Try doing it with out declaring Variables. When you get the path correct then clean up your code and declare variables.
The variable didn't work because his syntax was wrong. No space between the variable name, equals, and the path string.

Code:
#correct: variablex="applepie"
#incorrect: variablex= "applepie"
If you use linux, I highly recommend learning BASH.
 
Joined
Mar 31, 2012
Messages
541 (0.26/day)
Likes
113
System Name SIGSEGV
Processor Intel | AMD
Motherboard INVALID| X399
Cooling 2 Heatpipes | EK
Memory 16 Gb DDR4 2400 | 32 GB DDR4
Video Card(s) 1060 | MI25 / Vega Frontier | Tesla K
Storage 1TB 7200/256 SSD PCIE | ~ TB
Display(s) 15,5" / 27" LEDTV | No Display
Case Black & Grey
Audio Device(s) Realtek
Power Supply Silverstone 850W | Unrated PSU
Software LinuxMint KDE | XFCE
Benchmark Scores i dont care about scores
#11
The variable didn't work because his syntax was wrong. No space between the variable name, equals, and the path string.
i don't think so, it's clear enough for me given by that error messages, bash cannot find program called pathto and pathfrom, you should remember that bash will evaluate every line and find the appropriate program to execute, except you put $ in front of variable.

Code:
#!/bin/bash
$pathfrom="/path/to/downloads/folder"
$pathto="/path/to/store/files"

mv "$pathfrom/*.pdf" "$pathto/PDF"
mv "$pathfrom/*.rtf" "$pathto/RTF"
mv "$pathfrom/*.epub" "$pathto/EPUB"
mv "$pathfrom/*.html" "$pathto/HTML"
fixed


Code:
#correct: $variablex="applepie"
#correct: $variablex= "applepie"
this code is allowed in bash and has same meaning
 

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
10,401 (4.84/day)
Likes
5,481
Location
Concord, NH
System Name Kratos
Processor Intel Core i7 3930k @ 4.2Ghz
Motherboard ASUS P9X79 Deluxe
Cooling Zalman CPNS9900MAX 130mm
Memory G.Skill DDR3-2133, 16gb (4x4gb) @ 9-11-10-28-108-1T 1.65v
Video Card(s) MSI AMD Radeon R9 390 GAMING 8GB @ PCI-E 3.0
Storage 2x120Gb SATA3 Corsair Force GT Raid-0, 4x1Tb RAID-5, 1x500GB
Display(s) 1x LG 27UD69P (4k), 2x Dell S2340M (1080p)
Case Antec 1200
Audio Device(s) Onboard Realtek® ALC898 8-Channel High Definition Audio
Power Supply Seasonic 1000-watt 80 PLUS Platinum
Mouse Logitech G602
Keyboard Rosewill RK-9100
Software Ubuntu 17.10
Benchmark Scores Benchmarks aren't everything.
#12
this code is allowed in bash and has same meaning
Someone doesn't know what they're talking about and should refrain from posting when that is the case. :banghead:
Sounds like the OP poster isn't the only person who needs to learn BASH...

Code:
jdoane@khan:~$ somevar1="someweirdstring"
jdoane@khan:~$ somevar2= "someweirdstring"
someweirdstring: command not found
jdoane@khan:~$ echo $somevar1
someweirdstring
jdoane@khan:~$ echo $somevar2

jdoane@khan:~$
You also only use the $ when you're referencing the variable, not when you're assigning it...
Code:
jdoane@khan:~$ $someothervar="applepie"
=applepie: command not found
 
Last edited:
Joined
Oct 20, 2009
Messages
2,841 (0.95/day)
Likes
339
System Name FumoffuFumoffu
Processor Intel i7 4770K
Motherboard Gigabyte Z87X -UD3H
Cooling Corsair H100i
Memory 16GB DDR3 1600 Crucial Ballistix
Video Card(s) Sapphire AMD Radeon HD 7970 OC
Storage 1- WD 500GB 1- Samsung F2 1.5TB 1- Crucial M4 128GB SSD 1-256GB ADATA XPG SX900 ASX900S3 SSD
Display(s) Hanns-G HZ281HPB 27.5'' 3ms Full HD 1920x1200 WideScreen LCD Monitor
Case Corsair Graphite Series 600T
Audio Device(s) Creative Soundblaster X-Fi Titanium
Power Supply Corsair HX 750W Gold
Software Windows 7 Pro x64
#13
add a stderr redirection That will pipe stderr to nothing. If you want to make a log, then just replace /dev/null with the location of your log.



The variable didn't work because his syntax was wrong. No space between the variable name, equals, and the path string.

Code:
#correct: variablex="applepie"
#incorrect: variablex= "applepie"
If you use linux, I highly recommend learning BASH.
well, im in a networking degree program and this next semester we will be covering Linux Administration so I will be learning it. I am more familiar with BASICA/GWBASIC/QBASIC. I wrote Pacman in QBASIC.
 

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
10,401 (4.84/day)
Likes
5,481
Location
Concord, NH
System Name Kratos
Processor Intel Core i7 3930k @ 4.2Ghz
Motherboard ASUS P9X79 Deluxe
Cooling Zalman CPNS9900MAX 130mm
Memory G.Skill DDR3-2133, 16gb (4x4gb) @ 9-11-10-28-108-1T 1.65v
Video Card(s) MSI AMD Radeon R9 390 GAMING 8GB @ PCI-E 3.0
Storage 2x120Gb SATA3 Corsair Force GT Raid-0, 4x1Tb RAID-5, 1x500GB
Display(s) 1x LG 27UD69P (4k), 2x Dell S2340M (1080p)
Case Antec 1200
Audio Device(s) Onboard Realtek® ALC898 8-Channel High Definition Audio
Power Supply Seasonic 1000-watt 80 PLUS Platinum
Mouse Logitech G602
Keyboard Rosewill RK-9100
Software Ubuntu 17.10
Benchmark Scores Benchmarks aren't everything.
#14
well, im in a networking degree program and this next semester we will be covering Linux Administration so I will be learning it.
Right on. Get a head start, it's an administrator's best friend. :cool:
I wrote Pacman in QBASIC.
Nice! Back when I was in school I wrote a networked version of Backgammon using Java in my second year while I was working on my Computer Science degree. It's fun stuff, at least to me. :p
 
Joined
Mar 31, 2012
Messages
541 (0.26/day)
Likes
113
System Name SIGSEGV
Processor Intel | AMD
Motherboard INVALID| X399
Cooling 2 Heatpipes | EK
Memory 16 Gb DDR4 2400 | 32 GB DDR4
Video Card(s) 1060 | MI25 / Vega Frontier | Tesla K
Storage 1TB 7200/256 SSD PCIE | ~ TB
Display(s) 15,5" / 27" LEDTV | No Display
Case Black & Grey
Audio Device(s) Realtek
Power Supply Silverstone 850W | Unrated PSU
Software LinuxMint KDE | XFCE
Benchmark Scores i dont care about scores
#15
Someone doesn't know what they're talking about and should refrain from posting when that is the case. :banghead:
Sounds like the OP poster isn't the only person who needs to learn BASH...

Code:
jdoane@khan:~$ somevar1="someweirdstring"
jdoane@khan:~$ somevar2= "someweirdstring"
someweirdstring: command not found
jdoane@khan:~$ echo $somevar1
someweirdstring
jdoane@khan:~$ echo $somevar2

jdoane@khan:~$
You also only use the $ when you're referencing the variable, not when you're assigning it...
Code:
jdoane@khan:~$ $someothervar="applepie"
=applepie: command not found
i thougt it was the same syntax (and also rules) with php or another programming languages when you're assigning some value to any kind of variable.. .:laugh:
i found it funny..

thanks for your correction :toast:
 

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
10,401 (4.84/day)
Likes
5,481
Location
Concord, NH
System Name Kratos
Processor Intel Core i7 3930k @ 4.2Ghz
Motherboard ASUS P9X79 Deluxe
Cooling Zalman CPNS9900MAX 130mm
Memory G.Skill DDR3-2133, 16gb (4x4gb) @ 9-11-10-28-108-1T 1.65v
Video Card(s) MSI AMD Radeon R9 390 GAMING 8GB @ PCI-E 3.0
Storage 2x120Gb SATA3 Corsair Force GT Raid-0, 4x1Tb RAID-5, 1x500GB
Display(s) 1x LG 27UD69P (4k), 2x Dell S2340M (1080p)
Case Antec 1200
Audio Device(s) Onboard Realtek® ALC898 8-Channel High Definition Audio
Power Supply Seasonic 1000-watt 80 PLUS Platinum
Mouse Logitech G602
Keyboard Rosewill RK-9100
Software Ubuntu 17.10
Benchmark Scores Benchmarks aren't everything.
#16
i thougt it was the same syntax (and also rules) with php or another programming languages when you're assigning some value to any kind of variable.. .:laugh:
i found it funny..

thanks for your correction :toast:
If I'm not sure, I always test it out. You can never assume that the syntax of different languages will be similar. It definitely is an odd one, that's for sure, but on the other hand BASH was developed with a lot of different things in mind as compared to PHP, Java, ruby, or any other programming language for that matter, considering BASH isn't a programming language, it's a command processor. You write scripts that get evaluated by the processor as input, unlike PHP which gets compiled at runtime (unless you're using an opcode cache.) ;)
 

Mindweaver

Moderato®™
Staff member
Joined
Apr 16, 2009
Messages
6,580 (2.08/day)
Likes
3,913
Location
Charleston, SC
System Name Sechs / EyeSeven
Processor i7 5820k @ 4.5ghz / i7 2600k @ 4.0Ghz
Motherboard X99S GAMING 7 / ASRock Z68 Extreme3 Gen3
Cooling CORSAIR Hydro Series H100i Extreme / Stock cooler... H50 leaked!..
Memory G.Skill DDR4 2800 16GB 4x4GB / G.Skill DDR3 1600 8gb 2x4GB
Video Card(s) PNY Quadro K2000 / MSI GTX 970 GAMING 4Gb
Storage Samsung 850 PRO 256GB SSD /Intel 240gb, corsair 120gb SSD, 3x 1 tb s storage
Display(s) 2x Acer G276HL 27" 1080p / 3x Acer 22" Nvidia surround
Case Phanteks “Enthoo Pro series”/ Cooler Master Storm Scout
Audio Device(s) Azalia Realtek ALC1150 / SB X-Fi Gamer
Power Supply Corsair CXM CX600M / Corsair 600w
Mouse Razer DeathAdder Chroma / Razer DeathAdder
Keyboard Razer BlackWidow Ultimate /
Software Windows 10 Pro x64 / Windows 10 Pro x64
#17
The variable didn't work because his syntax was wrong. No space between the variable name, equals, and the path string.
I seen that, but I wanted him to see that as well. ;) I'd rather him start out not using variables until he understands bash better. :toast: Call it bias of me, but I tend not to give the full answer as quickly to Linux users as I do Windows users. :shadedshu I know I shouldn't, but I do.. ;) :toast: