These are chat archives for bangorunix/2015

7th
Apr 2015
rfrenchBangor
@rfrenchBangor
Apr 07 2015 12:03
@danprince @eeue56 Hello. With the assignment, it mentions that you will be running the script without root permissions. Does this mean you won't be able to use commands such as rm or touch to complete the game if needed?
Dan Prince
@danprince
Apr 07 2015 12:04
You don't need root to run RM or touch, unless you are removing files owned by root, or creating files in a folder owned by root
rfrenchBangor
@rfrenchBangor
Apr 07 2015 12:09
will not having root permissions stop us doing anything specific?
Dan Prince
@danprince
Apr 07 2015 12:13
Specifically it will stop you interacting with most files owned by the root user. Most of the folders outside of your home directory fall into this category
But this should't be a problem at all. If you need a refresher on the kind of challenge you should make, have another go at the original command line murder mystery we set
rfrenchBangor
@rfrenchBangor
Apr 07 2015 12:20
.... i've made part of my mystery where you have to remove specfic files in a directory for a clue to then 'generate', its not like the mystery game as such but i thought because i'm using commands frm unix it should be ok. Is this the case or should i follow the original murder mystery game more closely?
Dan Prince
@danprince
Apr 07 2015 12:22
The more original it is the better, I just meant that the original murder mystery was a good example of not needing to have root permissions to make a murder mystery
rfrenchBangor
@rfrenchBangor
Apr 07 2015 12:32
ah ok, thats a relief. My understanding of permissions is low soz. regular user on my unix can only do commands when using sudo, which is pain in arse, so got me worried that this would be the case when you are marking the assignment.
rfrenchBangor
@rfrenchBangor
Apr 07 2015 12:45
one more question! will i able to use cron as non-root aswell? seeing as it is editing a cron table, werent sure if that is a root owned file or not
rfrenchBangor
@rfrenchBangor
Apr 07 2015 13:01
@danprince actually dw i just read on interwebs its fine, thanks for help with assignment info tho
ajaykumar10
@ajaykumar10
Apr 07 2015 17:31
hey guys, i can't seem to make the readme script work for the assessment, i keep getting this error:
./p1: line 3: conditional binary operator expected
./p1: line 3: syntax error near *--help*' ./p1: line 3:if [[ == --help ]] ; then'
LukeWBangor
@LukeWBangor
Apr 07 2015 17:50
Accidentally just overwritten the script by giving a folder the same name. Is there any solutions to recover?
ajaykumar10
@ajaykumar10
Apr 07 2015 19:31
the $* in my script keeps disappearing when i make a project, is there any way for it to, say, not disappear?
Noah
@eeue56
Apr 07 2015 19:57
@rfrenchBangor The mystery should be both creatable and solvable by any user, not just those with root permisions.
@ajaykumar10 Sounds like you aren't doing if statements properly
Also, define "keeps disappearing"?
If your script is run without arguments then $* is empty.
ajaykumar10
@ajaykumar10
Apr 07 2015 20:04
i coped the example code stub in slide into my main script, but when i actually make a project, the $* in the secondary script has become blank and $PWD has changed into the directory path of the project
Noah
@eeue56
Apr 07 2015 20:06
[noah@noah-dev ~]$ cat dog.sh
#!/bin/bash

echo $*
[noah@noah-dev ~]$ cat cat.sh
#!/bin/bash

echo $*
./dog.sh 3 4

[noah@noah-dev ~]$ bash cat.sh 1 2
1 2
3 4
$* is the arguments passed when "calling" the script.
In the terminal, that looks like
bash dog.sh 1 2
So in dog.sh, $* expands to [1, 2]
However, if you then call dog.sh from another script then $* isn't magically passed down.
You have to pass the arguments onwards to dog.sh explicitly.
Noah
@eeue56
Apr 07 2015 20:12
Does that make sense?
ajaykumar10
@ajaykumar10
Apr 07 2015 20:14
sort of, how would you go about passing the arguments on?
Noah
@eeue56
Apr 07 2015 20:15
Guess
Noah
@eeue56
Apr 07 2015 20:21
I'll give you a hint, it's easier than you probably think
ajaykumar10
@ajaykumar10
Apr 07 2015 20:25
got it, cheers :)
plus, you gotta improve your hiniting abilities
Noah
@eeue56
Apr 07 2015 20:30
You earn better hints by guessing incorrectly 3 times
:P
ajaykumar10
@ajaykumar10
Apr 07 2015 20:32
aah of course, so obvious! :D
BenRbtz
@BenRbtz
Apr 07 2015 21:14
Just to make sure before I send in my script. Why would we provide a readme.txt on upload? As one will be generated with the execution of the script? Does the readme.txt reflect on the first script or the second script that is generated?
ajaykumar10
@ajaykumar10
Apr 07 2015 21:17
and just to clear things up, what exactly do we submit?
BenRbtz
@BenRbtz
Apr 07 2015 21:44
it says on the lab slides to submit README.txt, bash script and any additional files that the script depends on to work
ajaykumar10
@ajaykumar10
Apr 07 2015 22:24
aah, ok
cheers