Official Programmers Thread

  • Christian Chat is a moderated online Christian community allowing Christians around the world to fellowship with each other in real time chat via webcam, voice, and text, with the Christian Chat app. You can also start or participate in a Bible-based discussion here in the Christian Chat Forums, where members can also share with each other their own videos, pictures, or favorite Christian music.

    If you are a Christian and need encouragement and fellowship, we're here for you! If you are not a Christian but interested in knowing more about Jesus our Lord, you're also welcome! Want to know what the Bible says, and how you can apply it to your life? Join us!

    To make new Christian friends now around the world, click here to join Christian Chat.
W

wwjd_kilden

Guest
then maybe we can talk him into teaching by handing out cakes
 
W

wwjd_kilden

Guest
okai... question, again

(still bash)

How do I make variables that I change IN a loop also change OUTSIDE it?
I am trying to rename files, but they only "pretend to be" changed in the loop, yet really remain as they were -,-

I've changed my script so many times I just had to delete it :p nothing made sense

what I DO know is that
if i have:

string="abcægi"
string=${string//æ/A}
/ for one match, // if there can be severeal

would change the string to abcAgi ...replacing the unwanted letter

but as I have to use a for loop for file in *

it looks like the changes remain local (only change while in loop, and not in the actual file names)

sooo, any bright ideas?
 
B

Belgian_Pilot

Guest
Not tonight (demo), but tomorrow I'll have a look :)

(Wanna bet that on the time i figure it ou, you find it as well??? :p)
 
W

wwjd_kilden

Guest
hehehhe :D Maybe I do it because I get less stressed when I know someone else is thinking about it too :p

what confuses me about this thing is, bash variables are (according to what I've been reading the last hours) supposed to be global in the first place...
so I'm not sure what I'm doing wrong as they clearly aren't :p

but I think I'll give up for today, I've just been making it act more and more crazy ...
 
B

Belgian_Pilot

Guest
I can't answer that right now. I'm not familiar with bash... I'll have a look tomorrow :)

Unstressing helps often!
 
W

wwjd_kilden

Guest
tnks

yup, got intro to PHP tomorrow ! yay! (but kinda scary, as that means even more to remember for exams :p)
 
B

Belgian_Pilot

Guest
Yay :D PHP is nice for some dynamic website building...

Can't help you :p :p :p
 
W

wwjd_kilden

Guest
hehhe

that's why we're learning it, so this could get interesting... PHP, SQL and XHTML
 
B

Belgian_Pilot

Guest
SQL and XHTML no problem. I use ASP instead of PHP...
 
W

wwjd_kilden

Guest
my poor head, I wish what we are to learn during one year was what were to learn during two years :p
 
W

wwjd_kilden

Guest
yay, the file changed name

but it still refuses when I try to use regex insted of if [blabla] countructs :p


*goes on the hunt for someone who knows regex*
 
W

wwjd_kilden

Guest
hmm...
any ideas how to use the "$a" | tr "[:upper:]" "[:lower:]" (turns uppercase chars to lowercase) but somehow use the variable from a loop in it?
I have file names in a folder that should be checked for uppercase--

and any idea why my code makes duplicates even though I try to check it against my loop?

this is how I convert other characters (the convert is called in a for loop looping through all files in a folder:

(loop is: for filen in *)


convert()
{
gammeltnavn=$filen #oldname = thefile
nyfil=$gammeltnavn #newfile = oldname

nyfil=${nyfil/å/aa} # turns å into aa ....
nyfil=${nyfil/ø/oe}
nyfil=${nyfil/æ/ae}
nyfil=${nyfil/ /_}

#echo "$filen" | tr "[:upper:]" "[:lower:]" ### I want to turn uppercase to lowercase here, but this method didnt work



if [ "$gammeltnavn" == "$nyfil" ]; # if olname equals newfile
then
echo "ingen endring!!!!!!!!!!" # no change (would simply mean it tries converting something that dont need converting)
echo
continue
else

echo -n "Ulikt navn---" # different name
if [ "$nyfil" != "$filen" ]; then # opposite, if name is NOT equal, the file should be changed

echo "Filnavn endres" # filename changed
#mv $gammaltnavn $nyfil # does the actual changing


elif [ $nyfil == $filen ]; then # FAILS? this should check if the file made, already exists, but it still creates files with same name as in folder
echo "filnavn eksisterer fra før" #+ so it should not create a duplicate... yet it does
echo "oppgi filnavn.endelse" # prompts user for filename that dont match old files
read inn

#mv $gammaltnavn $inn

fi


fi
 
W

wwjd_kilden

Guest
thanks :)

Got a feeling I'll use that a lot
 
B

Belgian_Pilot

Guest
Can they help you? I see their forum is rather busy...
 
W

wwjd_kilden

Guest
havent been at the forum yet, will ask my teacher today and see if he can help, then check it out

thansk for the links oopsies :)
 
Jan 9, 2009
819
4
0
I have a question.

I want to send a mass e-mail to all the "People" in the office at my company. Problem is: I don't know thier names or thier e-mail addresses.
Is there a way to send a mass e-mail to whoever works at the company that has an e mail address? Like a bulk e-mail. Kind of like the junk e mails we all get.

That sort of thing. If there is a way, please tell me how.

Thanks
 
B

Belgian_Pilot

Guest
No.

Do you use exchange in your company?
 
Jan 9, 2009
819
4
0
I don't know if they do or not. They are not exactly willing to make things easy for us low life truck drivers