This forum is in archive mode. You will not be able to post new content.

Author Topic: [BASH] What?  (Read 2738 times)

0 Members and 1 Guest are viewing this topic.

Offline lucid

  • #Underground
  • Titan
  • **
  • Posts: 2683
  • Cookies: 243
  • psychonaut
    • View Profile
[BASH] What?
« on: July 19, 2013, 04:04:18 AM »
I have this script:

Code: [Select]
#!/bin/sh

## Erase contents of all files in /var/log
find /var/log -type f -exec sh -c '> "{}"' \;

## Erase contents of bash history and shutdown
cat /dev/null > .bash_history
shutdown -h now

It used to work, but now everytime I run it it gives me this:

Shutdown scheduled for Thu 2013-07-18 21:03:08 UTC, use 'shutdown -c' to cancel.

Which isn't really that big of a deal as that's only one minute away, but it never used to do that. Not only that, if I run shutdown -h now on it's own in the terminal it shuts down immediately. Why would it behave differently in the script than on it's own in the command line?
"Hacking is at least as much about ideas as about computers and technology. We use our skills to open doors that should never have been shut. We open these doors not only for our own benefit but for the benefit of others, too." - Brian the Hacker

Quote
15:04  @Phage : I'm bored of Python

Offline Nerotic7

  • Ultimate Faggot 9001
  • Knight
  • **
  • Posts: 151
  • Cookies: -37
    • View Profile
Re: [BASH] What?
« Reply #1 on: July 19, 2013, 04:47:28 AM »
Er, reinstall bash


<@Phage> I was put in place ONLY to take care of you.

Offline Deque

  • P.I.N.N.
  • Global Moderator
  • Overlord
  • *
  • Posts: 1203
  • Cookies: 518
  • Programmer, Malware Analyst
    • View Profile
Re: [BASH] What?
« Reply #2 on: July 19, 2013, 08:47:23 AM »
Why don't you use poweroff instead?

Offline techb

  • Soy Sauce Feeler
  • Global Moderator
  • King
  • *
  • Posts: 2350
  • Cookies: 345
  • Aliens do in fact wear hats.
    • View Profile
    • github
Re: [BASH] What?
« Reply #3 on: July 19, 2013, 09:11:12 AM »
Why don't you use poweroff instead?

Arch.

Laptop or desktop?
« Last Edit: July 19, 2013, 09:12:23 AM by techb »
>>>import this
-----------------------------

Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: [BASH] What?
« Reply #4 on: July 19, 2013, 09:15:11 AM »
I have this script:

Code: [Select]
#!/bin/sh

## Erase contents of all files in /var/log
find /var/log -type f -exec sh -c '> "{}"' \;

## Erase contents of bash history and shutdown
cat /dev/null > .bash_history
shutdown -h now

It used to work, but now everytime I run it it gives me this:

Shutdown scheduled for Thu 2013-07-18 21:03:08 UTC, use 'shutdown -c' to cancel.

Which isn't really that big of a deal as that's only one minute away, but it never used to do that. Not only that, if I run shutdown -h now on it's own in the terminal it shuts down immediately. Why would it behave differently in the script than on it's own in the command line?

Thats because I know you run arch.
These things are handled but systemd nowadays.
Use ; systemctl poweroff
Just throw something in your .bashrc to alias it.
Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage

Offline lucid

  • #Underground
  • Titan
  • **
  • Posts: 2683
  • Cookies: 243
  • psychonaut
    • View Profile
Re: [BASH] What?
« Reply #5 on: July 19, 2013, 06:13:14 PM »
Arch.

Laptop or desktop?

Laptop

Thats because I know you run arch.
These things are handled but systemd nowadays.
Use ; systemctl poweroff
Just throw something in your .bashrc to alias it.


Oh yeahhhhh. Totally forgot about that *facepalm*

Well, shutdown -h now used to work up until recently. Must have finally become depreciated.
"Hacking is at least as much about ideas as about computers and technology. We use our skills to open doors that should never have been shut. We open these doors not only for our own benefit but for the benefit of others, too." - Brian the Hacker

Quote
15:04  @Phage : I'm bored of Python

Offline Snayler

  • Baron
  • ****
  • Posts: 812
  • Cookies: 135
    • View Profile
Re: [BASH] What?
« Reply #6 on: July 19, 2013, 06:58:19 PM »
Must have finally become depreciated.
  *deprecated

Offline lucid

  • #Underground
  • Titan
  • **
  • Posts: 2683
  • Cookies: 243
  • psychonaut
    • View Profile
Re: [BASH] What?
« Reply #7 on: July 19, 2013, 07:45:40 PM »
Oh really?

Depreciated: to lower in estimation or esteem (Webster's)

Deprecated: Computer Science  To mark (a component of a software standard) as obsolete to warn against its use in the future so that it may be phased out. (Free Online Dictionary)

Seems you are right. Lol I've been pronouncing it as depreciated this whole time in my head.

EDIT: What the fuck!! proxx your advice didn't work like I thought it would. I changed it to systemctl poweroff and it still gives me the same output.
« Last Edit: July 19, 2013, 08:24:27 PM by lucid »
"Hacking is at least as much about ideas as about computers and technology. We use our skills to open doors that should never have been shut. We open these doors not only for our own benefit but for the benefit of others, too." - Brian the Hacker

Quote
15:04  @Phage : I'm bored of Python

Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: [BASH] What?
« Reply #8 on: July 19, 2013, 10:19:40 PM »
Oh really?

Depreciated: to lower in estimation or esteem (Webster's)

Deprecated: Computer Science  To mark (a component of a software standard) as obsolete to warn against its use in the future so that it may be phased out. (Free Online Dictionary)

Seems you are right. Lol I've been pronouncing it as depreciated this whole time in my head.

EDIT: What the fuck!! proxx your advice didn't work like I thought it would. I changed it to systemctl poweroff and it still gives me the same output.

systemctl reboot
systemctl poweroff
Quote
System Commands:
  default                         Enter system default mode
  rescue                          Enter system rescue mode
  emergency                       Enter system emergency mode
  halt                            Shut down and halt the system
  poweroff                        Shut down and power-off the system
  reboot                          Shut down and reboot the system
  kexec                           Shut down and reboot the system with kexec

That doesnt work ?

You sure you have the permissions ?
« Last Edit: July 19, 2013, 10:20:39 PM by proxx »
Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage

Offline lucid

  • #Underground
  • Titan
  • **
  • Posts: 2683
  • Cookies: 243
  • psychonaut
    • View Profile
Re: [BASH] What?
« Reply #9 on: July 20, 2013, 06:34:31 AM »
HOLY SHIT GUYS. You are all going to disown me as your EvilMate when I tell you this but it must be done so others can read this and not make the same mistake as I. I was running the alias command 'shutdown'. I just looked at my bashrc. Apparently I renamed it to wipedown some time ago and forgot.

So stupid.
« Last Edit: July 20, 2013, 06:35:00 AM by lucid »
"Hacking is at least as much about ideas as about computers and technology. We use our skills to open doors that should never have been shut. We open these doors not only for our own benefit but for the benefit of others, too." - Brian the Hacker

Quote
15:04  @Phage : I'm bored of Python

Offline Xires

  • Noob Eater
  • Administrator
  • Knight
  • *
  • Posts: 379
  • Cookies: 149
    • View Profile
    • Feed The Trolls - Xires
Re: [BASH] What?
« Reply #10 on: July 20, 2013, 11:14:08 AM »
Adding the full path to the binary you intend to run will usually bypass an alias.
-Xires

Offline lucid

  • #Underground
  • Titan
  • **
  • Posts: 2683
  • Cookies: 243
  • psychonaut
    • View Profile
Re: [BASH] What?
« Reply #11 on: July 20, 2013, 04:12:25 PM »
Adding the full path to the binary you intend to run will usually bypass an alias.

Wait, do you mean adding the full path in bashrc? Sorry I'm a little tired.
« Last Edit: July 20, 2013, 04:14:22 PM by lucid »
"Hacking is at least as much about ideas as about computers and technology. We use our skills to open doors that should never have been shut. We open these doors not only for our own benefit but for the benefit of others, too." - Brian the Hacker

Quote
15:04  @Phage : I'm bored of Python

Offline Xires

  • Noob Eater
  • Administrator
  • Knight
  • *
  • Posts: 379
  • Cookies: 149
    • View Profile
    • Feed The Trolls - Xires
Re: [BASH] What?
« Reply #12 on: July 20, 2013, 08:03:38 PM »
In the script that you want to call shutdown.
-Xires

Offline lucid

  • #Underground
  • Titan
  • **
  • Posts: 2683
  • Cookies: 243
  • psychonaut
    • View Profile
Re: [BASH] What?
« Reply #13 on: July 20, 2013, 09:48:15 PM »
In the script that you want to call shutdown.

Right. I'm slow sometimes.
"Hacking is at least as much about ideas as about computers and technology. We use our skills to open doors that should never have been shut. We open these doors not only for our own benefit but for the benefit of others, too." - Brian the Hacker

Quote
15:04  @Phage : I'm bored of Python

 



Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.