All pastes #388211 Raw Edit

Untitled

public shellscript v1 · immutable
·published 2007-03-09 22:17 UTC
rendered paste body
if this is the output im dealing with:#:~/mocptest$ mocp -iState: PLAYFile: /music/The Decemberists/The Crane Wife/07 Shankill Butchers.mp3Title: 7 The Decemberists - Shankill Butchers (The Crane Wife)Artist: The DecemberistsSongTitle: Shankill ButchersAlbum: The Crane WifeTotalTime: 04:40TimeLeft: 04:37TotalSec: 280CurrentTime: 00:03CurrentSec: 3Bitrate: 192KbpsRate: 44KHzis this the best / cleanest / fastest / cheapest (cpu wise) way of getting each line/field into its own var?#!/bin/bashO=$IFS IFS=$'\n' arr=($(mocp -i)) IFS=$Ostate=${arr[0]}file=${arr[1]}title=${arr[2]}artist=$[arr3]}songtitle=${arr[4]}album=${arr[5]}totaltime=${arr[6]}totalsec=${arr[7]}currenttime=${arr[8]}currentsec=${arr[8]}bitrate=${arr[9]}rate=${arr[10]