Linux for your taste (sorry Naw :D) (21 Viewers)

What OS do you use?

  • Windows

  • Linux

  • Mac

  • Other


Results are only viewable after voting.

Martin

Senior Member
Dec 31, 2000
56,913
Thanks to auto-complete, I find that it's a lot faster to get places using the terminal than clicking on stupid icons with the mouse.
omg you're becoming a proper geek :D geeks always say they navigate faster in the shell than in a file manager.

bes: not such a great idea to have a file with that kind of wacky characters in it. you could rename it

as for the wine thing, you have to run every windows app with "wine app.exe", so if you double click on it in a file manager it may not work. tho double clicking to run an application is bad form in general in linux, because usually either it's already an icon in your menu (if it's something you use all the time) or it's on the PATH (as I explained to Alucard) so you just type the name in the terminal without having to be in the directory where the file is.
 

Buy on AliExpress.com

JCK

Biased
JCK
May 11, 2004
125,388
Ok, I restarted my system just for the sake of restarting and I get this:

GRUB Loading stage1.5......................Read Error


Is there any way to recover from this? and how?
 
Oct 1, 2002
2,090
yes, iconv is installed in my system and it works :D .
however when googling I found that somebody use
" $iconv --from-code=Windows-1252 --to-code=UTF-8 /source.csv > /output.csv ",
while you use
" $iconv -f Windows-1252 -t UTF-8 /source.csv > /output.csv "

both way works.

can you tell me the difference between using -f and --from-code=param in shell?
 
Oct 1, 2002
2,090
I wonder if this is possible using only shell script(no php,java,etc).
I want to write a shell script to take input from db, and then based on the output I'll execute different function.

for example
#the select statement
mysql -u user -ppassword -e "select actionType from actiontable limit 1"
DBOutput=(result from previous select statement)
if [ "$DBOutput" = "Action1" ];
then
// do Action1
fi
 

Martin

Senior Member
Dec 31, 2000
56,913
I wonder if this is possible using only shell script(no php,java,etc).
I want to write a shell script to take input from db, and then based on the output I'll execute different function.

for example
#the select statement
mysql -u user -ppassword -e "select actionType from actiontable limit 1"
DBOutput=(result from previous select statement)
if [ "$DBOutput" = "Action1" ];
then
// do Action1
fi
Oh, ouch :D

Even if this is possible, you are really stretching the limits of what shell scripting is meant for. I really don't think it's possible but bash is so hackable that I wouldn't bet against it.

I really would encourage you instead to use a simple scripting language for this. Python has bindings to mysql, I bet ruby does too. These are languages that are very well suited to shell scripting, but they're also proper programming languages, with far more power than bash.
 
Oct 1, 2002
2,090
Oh, ouch :D

Even if this is possible, you are really stretching the limits of what shell scripting is meant for. I really don't think it's possible but bash is so hackable that I wouldn't bet against it.

I really would encourage you instead to use a simple scripting language for this. Python has bindings to mysql, I bet ruby does too. These are languages that are very well suited to shell scripting, but they're also proper programming languages, with far more power than bash.
I see,thnx, no wonder I haven't found any direct sample for that kind of operation. ^^
btw when you said well suited to shell scripting, what does that mean?
in Java to execute shell script, I need to get the runtime environment and then execute the shell script in another thread, and you pretty much must keep observing the other thread to know if it has finished running.
Do you mean Phyton has more control than java when executing shell script?
 

Martin

Senior Member
Dec 31, 2000
56,913
I see,thnx, no wonder I haven't found any direct sample for that kind of operation. ^^
btw when you said well suited to shell scripting, what does that mean?
in Java to execute shell script, I need to get the runtime environment and then execute the shell script in another thread, and you pretty much must keep observing the other thread to know if it has finished running.
Do you mean Phyton has more control than java when executing shell script?
java and shell scripting, please don't mention the two together again :p

the first and chief difference is that java is not a scripting language, it has to be compiled. who the hell would write scripts that would have to be compiled to classes just for simple operations? another thing is that since java is platform independent, you can't execute { cp, ls, grep, cat }, because there is no such thing as far as java is concerned, it cannot "access" the shell.

so forget about java, the sooner the better. :p

In python you can of course execute commands in the shell, just like with bash. The syntax is a little bit more complicated, but you have a very rich library to make up for that. Small demo:

Code:
#!/usr/bin/env python

import os

(sin, sout) = os.popen2("dmesg")         # run a shell command, capture output
print sout.read()                      # print the output we received
 
Oct 1, 2002
2,090
java and shell scripting, please don't mention the two together again :p

the first and chief difference is that java is not a scripting language, it has to be compiled. who the hell would write scripts that would have to be compiled to classes just for simple operations? another thing is that since java is platform independent, you can't execute { cp, ls, grep, cat }, because there is no such thing as far as java is concerned, it cannot "access" the shell.

so forget about java, the sooner the better. :p

In python you can of course execute commands in the shell, just like with bash. The syntax is a little bit more complicated, but you have a very rich library to make up for that. Small demo:

Code:
#!/usr/bin/env python

import os

(sin, sout) = os.popen2("dmesg")         # run a shell command, capture output
print sout.read()                      # print the output we received
ok, I got it.
time to check local library for some phyton book. :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 17)