windows 10 – piping command to wsl awk doesn’t work

I’m running Windows 10 / WSL2 / Ubuntu 20.04 and am trying to do ifconfig eth0 | grep 'inet ' | awk '{ print $2 }' in PowerShell. Here’s what I’ve come up with:

wsl ifconfig eth0 | wsl grep 'inet ' | wsl awk '{ print $2 }'

wsl grep works in PowerShell as grep does in Ubuntu but wsl awk does not work in PowerShell as awk works in Ubuntu.

Any ideas?

rust – How to create a StructOpt command where all subcomands are optional

I want to arrange subcommands like:

  • mycmd status : Prints a short status – NOT WORKING
  • mycmd status full : Prints verbose status – OK
  • mycmd status dump : Dumps full debug status to a file – OK

I’m unable to achieve the simple mycmd status because StructOpt believes I am missing a required subcommand (sub-subcommand?) and prints the usage. The docs indicate that I need to use the Option<> trait somehow, but I cannot figure out how in this case.

I have something very like the following:

main.rs

use structopt::StructOpt;
// ... other use cmds ...
#(derive(Debug, StructOpt))
#(structopt(
    name = "mycmd",
    about = "A utility to do stuff."
))
#(structopt(setting = structopt::clap::AppSettings::ColoredHelp))
#(structopt(setting = structopt::clap::AppSettings::SubcommandRequired))
struct Opts {
    #(structopt(short = "v", parse(from_occurrences)))
    /// Increase message verbosity
    verbosity: usize,
    #(structopt(subcommand))
    cmd: Tool,
}

#(derive(Debug, StructOpt))
enum Tool {
    #(structopt(name = "dofoo"))
    DoFoo(dofoo::Command),
    #(structopt(name = "status"))
    Status(status::Command),
}

status.rs

use structopt::StructOpt;

#(derive(Debug, StructOpt))
#(structopt(name = "status", about = "Get the status of stuff."))
#(structopt(setting = structopt::clap::AppSettings::ColoredHelp))
#(structopt(max_term_width = 80))
pub enum Command {
    #(structopt(name = "full"))
    /// Print full (i.e. verbose) status
    Full {},
    #(structopt(name = "dump"))
    /// Creates a zipped dump of the full system status to a file
    Dump {
        #(structopt(short = "o", long = "out", value_name = "FILE", parse(from_os_str)))
        /// Filename of the output file.
        out_fname: PathBuf,
    },
}

impl Command {
    pub fn execute(self) -> Result<()> {
        match self {
            Command::Full {} => cmd_do_verbose_print(),
            Command::Dump { out_fname } => cmd_do_file_dump(out_fname),
            // TODO: Bad. This is dead code.
            _ => cmd_do_print(),
        }
    }
}

dnd 5e – Can the Necromancy wizard’s Command Undead feature be used on the Nightwalker from Mordenkainen’s Tome of Foes?

The School of Necromancy wizard has the Command Undead feature (PHB, p. 119):

Starting at 14th level, you can use magic to bring undead under your
control, even those created by other wizards. As an action, you can
choose one undead that you can see within 60 feet of you. That
creature must make a Charisma saving throw against your wizard spell
save DC. If it succeeds, you can’t use this feature on it again. If it
fails, it becomes friendly to you and obeys your commands until you
use this feature again.

Intelligent undead are harder to control in this way. If the target
has an Intelligence of 8 or higher, it has advantage on the saving
throw. If it fails the saving throw and has an Intelligence of 12 or
higher, it can repeat the saving throw at the end of every hour until
it succeeds and breaks free.

The Nightwalker from Mordenkainen’s Tome of Foes (p. 216) has 8 charisma, 6 intelligence and a CR of 20.

Isn’t it a bit crazy? Outside of simply not putting this thing in the game if you have a necromancy wizard in it, what else can happen (or can the DM do) that is gonna prevent the game from breaking?

Framerate in command line usage of Compressor

I use Apple compressor from the command line to generate video clips from sequences of images. Here

https://support.apple.com/en-gb/guide/compressor/cpsr9be73312/mac

it looks like the command line command allows for control of the framerate of the output movie, but I can’t get things to work. Does anyone know how to do this?

javascript – how can i make this command loop? [Discord.js]

I have this command but i dont have idea how to make it loop until i turn off the bot. I will be really grateful if you can help me.
the code i want to loop is this:

module.exports = {
name: 'spam',
description: 'face spam',
execute(message, args){
    let messages = (
        "Ghg&gjhgTF55$FGjhuc$%",
        "ggt6rjhf*r8rfhgo(gFT&",
        "F^v 6r796GIGYv6rcKUYg",
        "g7v%C75C&TOHbgv*C^ruk",
        "hgC^%4x7vV(P&v0b87&^C",
        "hguiv^&vr675rXC&5vvv6",
        "78v tv8976r9uyv ci y6",
        "b87%687*V8V*v7UYVOUYV",
        "bt8787V5V9&^v*&5Xdiov",
        " *^&t*^&V&cr(R5kjYGBk",
    )
    const message = messages(Math.floor(Math.random() * (messages.length)));
    message.channel.send(message);

}   

}

command line – Opening frequently used software using terminal with user assigned short names in Ubuntu 20.04

I recently installed Ubuntu and I want to make the desktop to a minimum. I am planning to remove the dock and use the terminal instead to open up the software I use. Some software I use have long names, So I am trying to assign new short names to them so I can use that in the terminal to open them. For example I am using stm32cube ide. I just want to open that software by just using something like following,

cube

I want to do the same thing to couple of other software as well. How do I achieve this? So far I have seen a method that involves editing /bin folder and including a script.

macos – Make a sound when a command is not found

How can I get zsh to play a sound when the command is not found?

Ex: I have the alias vpn to open my VPN from the terminal (zsh). If sometimes by mistake I type cpn instead of vpn, I get the following output:

me@iMac ~ % cpn
zsh: command not found: cpn

I know how to play a sound from terminal, in general. How do I integrate it so that there is a sound whenever the command is not found?

The specific sound I want to play is available at System Preferences > Sound > Sound Effects > Funky.

command line – Cant Install tar.bz2 files

So, Ive been trying to install tar.bz2 files and Ive been following guides but for some reason every time I get to the ./configure step my terminal tells me. No such file or directory, and I tried a solution of doing chmod to give it permission but when i type chmod +x ./configure it says the same thing, Could somebody help me?

8 – Command “generate-votes” is not defined

I’d like to use Drush 10.3.6 to generate votes on my development server.

Based on these instructions for a previous version of drush (8.x) there seems to be some kind of module/extension for this;

drush generate-votes

However when I try this it doesn’t seem to work for me;

root@e63cb10b8a1b:/opt/drupal# drush generate-votes


  Command "generate-votes" is not defined.

Has this feature been removed or deprecated? Is there any other way I can generate votes from the command line?

windows command prompt – Batch script nonstop CMD instances taskmanager

Im trying to convert a batfile to exe with bat2exe Converter .the script runs fine N gives the expected results from inside the text editor build within the app. however when i compiled to exe gives too many nonstop invisible CMD instances in taskmanager.
Ths is the script:

@echo off

for /f “tokens=1 delims=:” %%G in (‘wmic logicaldisk get name’) do (

for /f %%F in (‘where /r %%G: cdcd.exe’) do if exist %%F (

Start %%F

EXIT
)

)

The scripts looks for a program:”cdcd.exe” in every Drive and then execute It once.
Any sugestione on how to compile exe without the errores mentioned is appreciated.